import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as i from"../../core/root/root.js";import*as n from"../../core/platform/platform.js";import*as s from"../../core/host/host.js";import*as o from"./utils/utils.js";export{o as Utils};import*as r from"../../models/text_utils/text_utils.js";import*as a from"../components/icon_button/icon_button.js";import*as l from"../components/settings/settings.js";import*as h from"../../core/dom_extension/dom_extension.js";import*as d from"../components/helpers/helpers.js";import*as c from"./theme_support/theme_support.js";import*as u from"../lit-html/lit-html.js";let m;class p{flavorsInternal;eventDispatchers;constructor(){this.flavorsInternal=new Map,this.eventDispatchers=new Map}static instance(e={forceNew:null}){const{forceNew:t}=e;return m&&!t||(m=new p),m}static removeInstance(){m=void 0}setFlavor(e,t){(this.flavorsInternal.get(e)||null)!==t&&(t?this.flavorsInternal.set(e,t):this.flavorsInternal.delete(e),this.dispatchFlavorChange(e,t))}dispatchFlavorChange(e,t){for(const i of b)i.contextTypes().includes(e)&&i.loadListener().then((e=>e.flavorChanged(t)));const i=this.eventDispatchers.get(e);i&&i.dispatchEventToListeners(g.FlavorChanged,t)}addFlavorChangeListener(t,i,n){let s=this.eventDispatchers.get(t);s||(s=new e.ObjectWrapper.ObjectWrapper,this.eventDispatchers.set(t,s)),s.addEventListener(g.FlavorChanged,i,n)}removeFlavorChangeListener(e,t,i){const n=this.eventDispatchers.get(e);n&&(n.removeEventListener(g.FlavorChanged,t,i),n.hasEventListeners(g.FlavorChanged)||this.eventDispatchers.delete(e))}flavor(e){return this.flavorsInternal.get(e)||null}flavors(){return new Set(this.flavorsInternal.keys())}}var g;(g||(g={})).FlavorChanged="FlavorChanged";const b=[];var f=Object.freeze({__proto__:null,Context:p,registerListener:function(e){b.push(e)}});const v={elements:"Elements",screenshot:"Screenshot",network:"Network",memory:"Memory",javascript_profiler:"JavaScript Profiler",console:"Console",performance:"Performance",mobile:"Mobile",help:"Help",layers:"Layers",navigation:"Navigation",drawer:"Drawer",global:"Global",resources:"Resources",background_services:"Background Services",settings:"Settings",debugger:"Debugger",sources:"Sources",rendering:"Rendering"},w=t.i18n.registerUIStrings("ui/legacy/ActionRegistration.ts",v),x=t.i18n.getLocalizedString.bind(void 0,w);class E extends e.ObjectWrapper.ObjectWrapper{enabledInternal=!0;toggledInternal=!1;actionRegistration;constructor(e){super(),this.actionRegistration=e}id(){return this.actionRegistration.actionId}async execute(){if(!this.actionRegistration.loadActionDelegate)return!1;const e=await this.actionRegistration.loadActionDelegate(),t=this.id();return e.handleAction(p.instance(),t)}icon(){return this.actionRegistration.iconClass}toggledIcon(){return this.actionRegistration.toggledIconClass}toggleWithRedColor(){return Boolean(this.actionRegistration.toggleWithRedColor)}setEnabled(e){this.enabledInternal!==e&&(this.enabledInternal=e,this.dispatchEventToListeners("Enabled",e))}enabled(){return this.enabledInternal}category(){return this.actionRegistration.category}tags(){if(this.actionRegistration.tags)return this.actionRegistration.tags.map((e=>e())).join("\0")}toggleable(){return Boolean(this.actionRegistration.toggleable)}title(){let e=this.actionRegistration.title?this.actionRegistration.title():t.i18n.lockedString("");const i=this.actionRegistration.options;if(i)for(const t of i)t.value!==this.toggledInternal&&(e=t.title());return e}toggled(){return this.toggledInternal}setToggled(e){console.assert(this.toggleable(),"Shouldn't be toggling an untoggleable action",this.id()),this.toggledInternal!==e&&(this.toggledInternal=e,this.dispatchEventToListeners("Toggled",e))}options(){return this.actionRegistration.options}contextTypes(){if(this.actionRegistration.contextTypes)return this.actionRegistration.contextTypes()}canInstantiate(){return Boolean(this.actionRegistration.loadActionDelegate)}bindings(){return this.actionRegistration.bindings}experiment(){return this.actionRegistration.experiment}condition(){return this.actionRegistration.condition}order(){return this.actionRegistration.order}}const I=[],S=new Set;function y(){S.clear(),I.length=0}function C(){return I.filter((e=>i.Runtime.Runtime.isDescriptorEnabled({experiment:e.experiment(),condition:e.condition()}))).sort(((e,t)=>(e.order()||0)-(t.order()||0)))}var k;!function(e){e.NONE="",e.ELEMENTS="ELEMENTS",e.SCREENSHOT="SCREENSHOT",e.NETWORK="NETWORK",e.MEMORY="MEMORY",e.JAVASCRIPT_PROFILER="JAVASCRIPT_PROFILER",e.CONSOLE="CONSOLE",e.PERFORMANCE="PERFORMANCE",e.MOBILE="MOBILE",e.HELP="HELP",e.LAYERS="LAYERS",e.NAVIGATION="NAVIGATION",e.DRAWER="DRAWER",e.GLOBAL="GLOBAL",e.RESOURCES="RESOURCES",e.BACKGROUND_SERVICES="BACKGROUND_SERVICES",e.SETTINGS="SETTINGS",e.DEBUGGER="DEBUGGER",e.SOURCES="SOURCES",e.RENDERING="RENDERING"}(k||(k={}));var T=Object.freeze({__proto__:null,Action:E,registerActionExtension:function(e){const t=e.actionId;if(S.has(t))throw new Error(`Duplicate Action id '${t}': ${(new Error).stack}`);S.add(t),I.push(new E(e))},reset:y,getRegisteredActionExtensions:C,maybeRemoveActionExtension:function(e){const t=I.findIndex((t=>t.id()===e));return!(t<0||!S.delete(e))&&(I.splice(t,1),!0)},get ActionCategory(){return k},getLocalizedActionCategory:function(e){switch(e){case k.ELEMENTS:return x(v.elements);case k.SCREENSHOT:return x(v.screenshot);case k.NETWORK:return x(v.network);case k.MEMORY:return x(v.memory);case k.JAVASCRIPT_PROFILER:return x(v.javascript_profiler);case k.CONSOLE:return x(v.console);case k.PERFORMANCE:return x(v.performance);case k.MOBILE:return x(v.mobile);case k.HELP:return x(v.help);case k.LAYERS:return x(v.layers);case k.NAVIGATION:return x(v.navigation);case k.DRAWER:return x(v.drawer);case k.GLOBAL:return x(v.global);case k.RESOURCES:return x(v.resources);case k.BACKGROUND_SERVICES:return x(v.background_services);case k.SETTINGS:return x(v.settings);case k.DEBUGGER:return x(v.debugger);case k.SOURCES:return x(v.sources);case k.RENDERING:return x(v.rendering);case k.NONE:return t.i18n.lockedString("")}return t.i18n.lockedString(e)}});let M;class L{actionsById;constructor(){this.actionsById=new Map,this.registerActions()}static instance(e={forceNew:null}){const{forceNew:t}=e;return M&&!t||(M=new L),M}static removeInstance(){M=void 0}static reset(){L.removeInstance(),y()}registerActions(){for(const e of C())this.actionsById.set(e.id(),e),e.canInstantiate()||e.setEnabled(!1)}availableActions(){return this.applicableActions([...this.actionsById.keys()],p.instance())}actions(){return[...this.actionsById.values()]}applicableActions(e,t){const i=[];for(const s of e){const e=this.actionsById.get(s);e&&e.enabled()&&n(e,t.flavors())&&i.push(e)}return i;function n(e,t){const i=e.contextTypes();if(!i)return!0;for(let e=0;e<i.length;++e){const n=i[e];if(Boolean(n)&&t.has(n))return!0}return!1}}action(e){return this.actionsById.get(e)||null}}var P=Object.freeze({__proto__:null,ActionRegistry:L});let D=0;function R(e){return(e||"")+ ++D}function A(e,t){const i=R("labelledControl");t.id=i,e.setAttribute("for",i)}function O(e){e.setAttribute("role","alert"),e.setAttribute("aria-live","polite")}function B(e){e.setAttribute("role","button")}function W(e){e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true")}function F(e){e.setAttribute("role","group")}function H(e){e.setAttribute("role","link")}function z(e){B(e),e.setAttribute("aria-haspopup","true")}function N(e){e.setAttribute("role","tab")}function _(e){e.setAttribute("role","tabpanel")}function V(e){e.setAttribute("role","tree")}function U(e){e.setAttribute("role","treeitem")}function K(e){e.setAttribute("role","textbox")}function j(e){e.setAttribute("role","menu")}function q(e){e.setAttribute("role","menuitem")}function G(e){e.setAttribute("role","menuitemcheckbox")}function X(e){q(e),e.setAttribute("aria-haspopup","true")}function Y(e){e.setAttribute("role","complementary")}function $(e){e.setAttribute("role","navigation")}function Q(e){e.setAttribute("role","listbox")}function Z(e){e.setAttribute("aria-multiselectable","true")}function J(e){e.setAttribute("role","option")}function ee(e){e.setAttribute("aria-hidden","true")}function te(e,t){e.setAttribute("role","heading"),e.setAttribute("aria-level",t.toString())}function ie(e){return e.hasAttribute("role")}function ne(e,t){t?e.setAttribute("aria-placeholder",t):e.removeAttribute("aria-placeholder")}function se(e){e.id||(e.id=R("ariaElement"))}function oe(e,t){t?(se(t),e.setAttribute("aria-controls",t.id)):e.removeAttribute("aria-controls")}function re(e,t){e.setAttribute("aria-expanded",Boolean(t).toString())}function ae(e){e.removeAttribute("aria-expanded")}var le;function he(e,t=le.none){e.setAttribute("aria-autocomplete",t)}function de(e){e.removeAttribute("aria-autocomplete")}function ce(e,t="false"){"false"!==t?e.setAttribute("aria-haspopup",t):e.removeAttribute("aria-haspopup")}function ue(e,t){e.setAttribute("aria-selected",Boolean(t).toString())}function me(e){e.removeAttribute("aria-selected")}function pe(e,t){t?e.setAttribute("aria-invalid",t.toString()):e.removeAttribute("aria-invalid")}function ge(e,t){e.setAttribute("aria-pressed",Boolean(t).toString())}function be(e,t){e.setAttribute("aria-label",t)}function fe(e,t){e.setAttribute("aria-description",t)}function ve(e,t){t?(t.isConnected&&e.isConnected&&console.assert(n.DOMUtilities.getEnclosingShadowRootForNode(t)===n.DOMUtilities.getEnclosingShadowRootForNode(e),"elements are not in the same shadow dom"),se(t),e.setAttribute("aria-activedescendant",t.id)):e.removeAttribute("aria-activedescendant")}function we(e,t){e.setAttribute("aria-setsize",t.toString())}function xe(e,t){e.setAttribute("aria-posinset",t.toString())}function Ee(e){e.style.position="absolute",e.style.left="-999em",e.style.width="100em",e.style.overflow="hidden"}let Ie,Se;!function(e){e.inline="inline",e.list="list",e.both="both",e.none="none"}(le||(le={}));let ye=!1;function Ce(){if(!Ie){const e=document.body.createChild("div");Ee(e),e.setAttribute("role","alert"),e.setAttribute("aria-atomic","true"),Ie=e}if(!Se){const e=document.body.createChild("div");Ee(e),e.setAttribute("role","alert"),e.setAttribute("aria-atomic","true"),Se=e}return ye=!ye,ye?(Se.textContent="",Ie):(Ie.textContent="",Se)}function ke(e){Ce().textContent=n.StringUtilities.trimEndWithMaxLength(e,1e4)}var Te=Object.freeze({__proto__:null,nextId:R,bindLabelToControl:A,markAsAlert:O,markAsApplication:function(e){e.setAttribute("role","application")},markAsButton:B,markAsCheckbox:function(e){e.setAttribute("role","checkbox")},markAsCombobox:function(e){e.setAttribute("role","combobox")},markAsModalDialog:W,markAsGroup:F,markAsLink:H,markAsMenuButton:z,markAsProgressBar:function(e,t=0,i=100){e.setAttribute("role","progressbar"),e.setAttribute("aria-valuemin",t.toString()),e.setAttribute("aria-valuemax",i.toString())},markAsTab:N,markAsTablist:function(e){e.setAttribute("role","tablist")},markAsTabpanel:_,markAsTree:V,markAsTreeitem:U,markAsTextBox:K,markAsMenu:j,markAsMenuItem:q,markAsMenuItemCheckBox:G,markAsMenuItemSubMenu:X,markAsList:function(e){e.setAttribute("role","list")},markAsListitem:function(e){e.setAttribute("role","listitem")},markAsMain:function(e){e.setAttribute("role","main")},markAsComplementary:Y,markAsNavigation:$,markAsListBox:Q,markAsMultiSelectable:Z,markAsOption:J,markAsRadioGroup:function(e){e.setAttribute("role","radiogroup")},markAsHidden:ee,markAsSlider:function(e,t=0,i=100){e.setAttribute("role","slider"),e.setAttribute("aria-valuemin",String(t)),e.setAttribute("aria-valuemax",String(i))},markAsHeading:te,markAsPoliteLiveRegion:function(e,t){e.setAttribute("aria-live","polite"),t&&e.setAttribute("aria-atomic","true")},markAsLog:function(e){e.setAttribute("role","log")},hasRole:ie,removeRole:function(e){e.removeAttribute("role")},setPlaceholder:ne,markAsPresentation:function(e){e.setAttribute("role","presentation")},markAsStatus:function(e){e.setAttribute("role","status")},ensureId:se,setAriaValueText:function(e,t){e.setAttribute("aria-valuetext",t)},setAriaValueNow:function(e,t){e.setAttribute("aria-valuenow",t)},setAriaValueMinMax:function(e,t,i){e.setAttribute("aria-valuemin",t),e.setAttribute("aria-valuemax",i)},setControls:oe,setChecked:function(e,t){e.setAttribute("aria-checked",Boolean(t).toString())},setCheckboxAsIndeterminate:function(e){e.setAttribute("aria-checked","mixed")},setDisabled:function(e,t){e.setAttribute("aria-disabled",Boolean(t).toString())},setExpanded:re,unsetExpandable:ae,setHidden:function(e,t){e.setAttribute("aria-hidden",Boolean(t).toString())},setLevel:function(e,t){e.setAttribute("aria-level",t.toString())},get AutocompleteInteractionModel(){return le},setAutocomplete:he,clearAutocomplete:de,setHasPopup:ce,setSelected:ue,clearSelected:me,setInvalid:pe,setPressed:ge,setValueNow:function(e,t){e.setAttribute("aria-valuenow",t.toString())},setValueText:function(e,t){e.setAttribute("aria-valuetext",t.toString())},setProgressBarValue:function(e,t,i){e.setAttribute("aria-valuenow",t.toString()),i&&e.setAttribute("aria-valuetext",i)},setLabel:be,setDescription:fe,setActiveDescendant:ve,setSetSize:we,setPositionInSet:xe,alertElementInstance:Ce,alert:ke}),Me=Object.freeze({__proto__:null});let Le=null;class Pe extends HTMLSpanElement{descriptor;spriteSheet;iconType;constructor(){super(),this.descriptor=null,this.spriteSheet=null,this.iconType=""}static create(e,t){Le||(Le=o.registerCustomElement("span","ui-icon",Pe));const i=Le();return t&&(i.className=t),e&&i.setIconType(e),i}setIconType(e){this.descriptor&&(this.style.removeProperty("--spritesheet-position"),this.style.removeProperty("width"),this.style.removeProperty("height"),this.toggleClasses(!1),this.iconType="",this.descriptor=null,this.spriteSheet=null);const t=Ae.get(e)||null;if(t){if(this.iconType=e,this.descriptor=t,this.spriteSheet=Re.get(this.descriptor.spritesheet)||null,!this.spriteSheet)throw new Error(`ERROR: icon ${this.iconType} has unknown spritesheet: ${this.descriptor.spritesheet}`);this.style.setProperty("--spritesheet-position",this.propertyValue()),this.style.setProperty("width",this.spriteSheet.cellWidth+"px"),this.style.setProperty("height",this.spriteSheet.cellHeight+"px"),this.toggleClasses(!0)}else if(e)throw new Error(`ERROR: failed to find icon descriptor for type: ${e}`)}setIconColor(e){this.style.setProperty("background-color",e)}toggleClasses(e){this.descriptor&&(this.classList.toggle("spritesheet-"+this.descriptor.spritesheet,e),this.classList.toggle(this.iconType,e),this.classList.toggle("icon-mask",e&&Boolean(this.descriptor.isMask)),this.classList.toggle("icon-invert",e&&Boolean(this.descriptor.invert)))}propertyValue(){if(!this.descriptor||!this.spriteSheet)throw new Error("Descriptor and spriteSheet expected to be present");if(!this.descriptor.coordinates){if(!this.descriptor.position||!De.test(this.descriptor.position))throw new Error(`ERROR: icon '${this.iconType}' has malformed position: '${this.descriptor.position}'`);const e=this.descriptor.position[0].toLowerCase().charCodeAt(0)-97,t=parseInt(this.descriptor.position.substring(1),10)-1;this.descriptor.coordinates={x:-(this.spriteSheet.cellWidth+this.spriteSheet.padding)*e,y:(this.spriteSheet.cellHeight+this.spriteSheet.padding)*(t+1)-this.spriteSheet.padding}}return`${this.descriptor.coordinates.x}px ${this.descriptor.coordinates.y}px`}}const De=/^[a-z][1-9][0-9]*$/,Re=new Map([["smallicons",{cellWidth:10,cellHeight:10,padding:10}],["mediumicons",{cellWidth:16,cellHeight:16,padding:0}],["largeicons",{cellWidth:28,cellHeight:24,padding:0}],["arrowicons",{cellWidth:19,cellHeight:19,padding:0}],["3d-center",{cellWidth:20,cellHeight:20,padding:0}],["3d-pan",{cellWidth:20,cellHeight:20,padding:0}],["3d-rotate",{cellWidth:20,cellHeight:20,padding:0}],["arrow-up-down-circle",{cellWidth:20,cellHeight:20,padding:0}],["arrow-up-down",{cellWidth:20,cellHeight:20,padding:0}],["bell",{cellWidth:20,cellHeight:20,padding:0}],["bezier-curve-filled",{cellWidth:20,cellHeight:20,padding:0}],["bin",{cellWidth:20,cellHeight:20,padding:0}],["bottom-panel-close",{cellWidth:20,cellHeight:20,padding:0}],["bottom-panel-open",{cellWidth:20,cellHeight:20,padding:0}],["brackets",{cellWidth:20,cellHeight:20,padding:0}],["breakpoint-crossed-filled",{cellWidth:20,cellHeight:20,padding:0}],["breakpoint-crossed",{cellWidth:20,cellHeight:20,padding:0}],["brush-filled",{cellWidth:20,cellHeight:20,padding:0}],["brush",{cellWidth:20,cellHeight:20,padding:0}],["bug",{cellWidth:20,cellHeight:20,padding:0}],["check-double",{cellWidth:20,cellHeight:20,padding:0}],["checkmark",{cellWidth:20,cellHeight:20,padding:0}],["chevron-double-right",{cellWidth:20,cellHeight:20,padding:0}],["chevron-down",{cellWidth:20,cellHeight:20,padding:0}],["chevron-up",{cellWidth:20,cellHeight:20,padding:0}],["clear-list",{cellWidth:20,cellHeight:20,padding:0}],["clear",{cellWidth:20,cellHeight:20,padding:0}],["cloud",{cellWidth:20,cellHeight:20,padding:0}],["code-circle",{cellWidth:20,cellHeight:20,padding:0}],["color-picker-filled",{cellWidth:20,cellHeight:20,padding:0}],["color-picker",{cellWidth:20,cellHeight:20,padding:0}],["cookie",{cellWidth:20,cellHeight:20,padding:0}],["copy",{cellWidth:20,cellHeight:20,padding:0}],["credit-card",{cellWidth:20,cellHeight:20,padding:0}],["cross-circle",{cellWidth:20,cellHeight:20,padding:0}],["cross",{cellWidth:20,cellHeight:20,padding:0}],["custom-typography",{cellWidth:20,cellHeight:20,padding:0}],["database",{cellWidth:20,cellHeight:20,padding:0}],["device-fold",{cellWidth:20,cellHeight:20,padding:0}],["devices",{cellWidth:20,cellHeight:20,padding:0}],["dock-bottom",{cellWidth:20,cellHeight:20,padding:0}],["dock-left",{cellWidth:20,cellHeight:20,padding:0}],["dock-right",{cellWidth:20,cellHeight:20,padding:0}],["dock-window",{cellWidth:20,cellHeight:20,padding:0}],["document",{cellWidth:20,cellHeight:20,padding:0}],["dots-vertical",{cellWidth:20,cellHeight:20,padding:0}],["download",{cellWidth:20,cellHeight:20,padding:0}],["edit",{cellWidth:20,cellHeight:20,padding:0}],["experiment-check",{cellWidth:20,cellHeight:20,padding:0}],["eye",{cellWidth:20,cellHeight:20,padding:0}],["filter-clear",{cellWidth:20,cellHeight:20,padding:0}],["filter-filled",{cellWidth:20,cellHeight:20,padding:0}],["filter",{cellWidth:20,cellHeight:20,padding:0}],["frame-crossed",{cellWidth:20,cellHeight:20,padding:0}],["frame",{cellWidth:20,cellHeight:20,padding:0}],["gear-filled",{cellWidth:20,cellHeight:20,padding:0}],["gear",{cellWidth:20,cellHeight:20,padding:0}],["gears",{cellWidth:20,cellHeight:20,padding:0}],["heap-snapshot",{cellWidth:20,cellHeight:20,padding:0}],["heap-snapshots",{cellWidth:20,cellHeight:20,padding:0}],["iframe-crossed",{cellWidth:20,cellHeight:20,padding:0}],["iframe",{cellWidth:20,cellHeight:20,padding:0}],["import",{cellWidth:20,cellHeight:20,padding:0}],["info",{cellWidth:20,cellHeight:20,padding:0}],["keyboard-pen",{cellWidth:20,cellHeight:20,padding:0}],["layers-filled",{cellWidth:20,cellHeight:20,padding:0}],["layers",{cellWidth:20,cellHeight:20,padding:0}],["left-panel-close",{cellWidth:20,cellHeight:20,padding:0}],["left-panel-open",{cellWidth:20,cellHeight:20,padding:0}],["list",{cellWidth:20,cellHeight:20,padding:0}],["pause",{cellWidth:20,cellHeight:20,padding:0}],["play",{cellWidth:20,cellHeight:20,padding:0}],["plus",{cellWidth:20,cellHeight:20,padding:0}],["popup",{cellWidth:20,cellHeight:20,padding:0}],["profile",{cellWidth:20,cellHeight:20,padding:0}],["record-start",{cellWidth:20,cellHeight:20,padding:0}],["record-stop",{cellWidth:20,cellHeight:20,padding:0}],["refresh",{cellWidth:20,cellHeight:20,padding:0}],["replace",{cellWidth:20,cellHeight:20,padding:0}],["replay",{cellWidth:20,cellHeight:20,padding:0}],["resume",{cellWidth:20,cellHeight:20,padding:0}],["right-panel-close",{cellWidth:20,cellHeight:20,padding:0}],["right-panel-open",{cellWidth:20,cellHeight:20,padding:0}],["screen-rotation",{cellWidth:20,cellHeight:20,padding:0}],["search",{cellWidth:20,cellHeight:20,padding:0}],["select-element",{cellWidth:20,cellHeight:20,padding:0}],["shadow",{cellWidth:20,cellHeight:20,padding:0}],["step-into",{cellWidth:20,cellHeight:20,padding:0}],["step-out",{cellWidth:20,cellHeight:20,padding:0}],["step-over",{cellWidth:20,cellHeight:20,padding:0}],["step",{cellWidth:20,cellHeight:20,padding:0}],["stop",{cellWidth:20,cellHeight:20,padding:0}],["sync",{cellWidth:20,cellHeight:20,padding:0}],["table",{cellWidth:20,cellHeight:20,padding:0}],["top-panel-close",{cellWidth:20,cellHeight:20,padding:0}],["top-panel-open",{cellWidth:20,cellHeight:20,padding:0}],["triangle-bottom-right",{cellWidth:20,cellHeight:20,padding:0}],["triangle-down",{cellWidth:14,cellHeight:14,padding:0}],["triangle-left",{cellWidth:14,cellHeight:14,padding:0}],["triangle-right",{cellWidth:14,cellHeight:14,padding:0}],["triangle-up",{cellWidth:14,cellHeight:14,padding:0}],["undo",{cellWidth:20,cellHeight:20,padding:0}],["warning",{cellWidth:20,cellHeight:20,padding:0}],["watch",{cellWidth:20,cellHeight:20,padding:0}]]),Ae=new Map([["mediumicon-arrow-top",{position:"a4",spritesheet:"arrowicons"}],["mediumicon-arrow-bottom",{position:"a3",spritesheet:"arrowicons"}],["mediumicon-arrow-left",{position:"a2",spritesheet:"arrowicons"}],["mediumicon-arrow-right",{position:"a1",spritesheet:"arrowicons"}],["3d-center",{position:"a1",spritesheet:"3d-center",isMask:!0}],["3d-pan",{position:"a1",spritesheet:"3d-pan",isMask:!0}],["3d-rotate",{position:"a1",spritesheet:"3d-rotate",isMask:!0}],["arrow-up-down",{position:"a1",spritesheet:"arrow-up-down",isMask:!0}],["arrow-up-down-circle",{position:"a1",spritesheet:"arrow-up-down-circle",isMask:!0}],["bell",{position:"a1",spritesheet:"bell",isMask:!0}],["bezier-curve-filled",{position:"a1",spritesheet:"bezier-curve-filled",isMask:!0}],["bin",{position:"a1",spritesheet:"bin",isMask:!0}],["bottom-panel-close",{position:"a1",spritesheet:"bottom-panel-close",isMask:!0}],["bottom-panel-open",{position:"a1",spritesheet:"bottom-panel-open",isMask:!0}],["brackets",{position:"a1",spritesheet:"brackets",isMask:!0}],["breakpoint-crossed-filled",{position:"a1",spritesheet:"breakpoint-crossed-filled",isMask:!0}],["breakpoint-crossed",{position:"a1",spritesheet:"breakpoint-crossed",isMask:!0}],["brush-filled",{position:"a1",spritesheet:"brush-filled",isMask:!0}],["brush",{position:"a1",spritesheet:"brush",isMask:!0}],["bug",{position:"a1",spritesheet:"bug",isMask:!0}],["check-double",{position:"a1",spritesheet:"check-double",isMask:!0}],["checkmark",{position:"a1",spritesheet:"checkmark",isMask:!0}],["chevron-double-right",{position:"a1",spritesheet:"chevron-double-right",isMask:!0}],["chevron-down",{position:"a1",spritesheet:"chevron-down",isMask:!0}],["chevron-up",{position:"a1",spritesheet:"chevron-up",isMask:!0}],["clear-list",{position:"a1",spritesheet:"clear-list",isMask:!0}],["clear",{position:"a1",spritesheet:"clear",isMask:!0}],["cloud",{position:"a1",spritesheet:"cloud",isMask:!0}],["code-circle",{position:"a1",spritesheet:"code-circle",isMask:!0}],["color-picker-filled",{position:"a1",spritesheet:"color-picker-filled",isMask:!0}],["color-picker",{position:"a1",spritesheet:"color-picker",isMask:!0}],["cookie",{position:"a1",spritesheet:"cookie",isMask:!0}],["copy",{position:"a1",spritesheet:"copy",isMask:!0}],["credit-card",{position:"a1",spritesheet:"credit-card",isMask:!0}],["cross-circle",{position:"a1",spritesheet:"cross-circle",isMask:!0}],["cross",{position:"a1",spritesheet:"cross",isMask:!0}],["custom-typography",{position:"a1",spritesheet:"custom-typography",isMask:!0}],["database",{position:"a1",spritesheet:"database",isMask:!0}],["device-fold",{position:"a1",spritesheet:"device-fold",isMask:!0}],["devices",{position:"a1",spritesheet:"devices",isMask:!0}],["dock-bottom",{position:"a1",spritesheet:"dock-bottom",isMask:!0}],["dock-left",{position:"a1",spritesheet:"dock-left",isMask:!0}],["dock-right",{position:"a1",spritesheet:"dock-right",isMask:!0}],["dock-window",{position:"a1",spritesheet:"dock-window",isMask:!0}],["document",{position:"a1",spritesheet:"document",isMask:!0}],["dots-vertical",{position:"a1",spritesheet:"dots-vertical",isMask:!0}],["download",{position:"a1",spritesheet:"download",isMask:!0}],["edit",{position:"a1",spritesheet:"edit",isMask:!0}],["experiment-check",{position:"a1",spritesheet:"experiment-check",isMask:!0}],["eye",{position:"a1",spritesheet:"eye",isMask:!0}],["filter-clear",{position:"a1",spritesheet:"filter-clear",isMask:!0}],["filter-filled",{position:"a1",spritesheet:"filter-filled",isMask:!0}],["filter",{position:"a1",spritesheet:"filter",isMask:!0}],["frame-crossed",{position:"a1",spritesheet:"frame-crossed",isMask:!0}],["frame",{position:"a1",spritesheet:"frame",isMask:!0}],["gear-filled",{position:"a1",spritesheet:"gear-filled",isMask:!0}],["gear",{position:"a1",spritesheet:"gear",isMask:!0}],["gears",{position:"a1",spritesheet:"gears",isMask:!0}],["heap-snapshot",{position:"a1",spritesheet:"heap-snapshot",isMask:!0}],["heap-snapshots",{position:"a1",spritesheet:"heap-snapshots",isMask:!0}],["iframe-crossed",{position:"a1",spritesheet:"iframe-crossed",isMask:!0}],["iframe",{position:"a1",spritesheet:"iframe",isMask:!0}],["import",{position:"a1",spritesheet:"import",isMask:!0}],["info",{position:"a1",spritesheet:"info",isMask:!0}],["keyboard-pen",{position:"a1",spritesheet:"keyboard-pen",isMask:!0}],["layers-filled",{position:"a1",spritesheet:"layers-filled",isMask:!0}],["layers",{position:"a1",spritesheet:"layers",isMask:!0}],["left-panel-close",{position:"a1",spritesheet:"left-panel-close",isMask:!0}],["left-panel-open",{position:"a1",spritesheet:"left-panel-open",isMask:!0}],["list",{position:"a1",spritesheet:"list",isMask:!0}],["pause",{position:"a1",spritesheet:"pause",isMask:!0}],["play",{position:"a1",spritesheet:"play",isMask:!0}],["plus",{position:"a1",spritesheet:"plus",isMask:!0}],["popup",{position:"a1",spritesheet:"popup",isMask:!0}],["profile",{position:"a1",spritesheet:"profile",isMask:!0}],["record-start",{position:"a1",spritesheet:"record-start",isMask:!0}],["record-stop",{position:"a1",spritesheet:"record-stop",isMask:!0}],["refresh",{position:"a1",spritesheet:"refresh",isMask:!0}],["replace",{position:"a1",spritesheet:"replace",isMask:!0}],["replay",{position:"a1",spritesheet:"replay",isMask:!0}],["resume",{position:"a1",spritesheet:"resume",isMask:!0}],["right-panel-close",{position:"a1",spritesheet:"right-panel-close",isMask:!0}],["right-panel-open",{position:"a1",spritesheet:"right-panel-open",isMask:!0}],["screen-rotation",{position:"a1",spritesheet:"screen-rotation",isMask:!0}],["search",{position:"a1",spritesheet:"search",isMask:!0}],["select-element",{position:"a1",spritesheet:"select-element",isMask:!0}],["shadow",{position:"a1",spritesheet:"shadow",isMask:!0}],["step-into",{position:"a1",spritesheet:"step-into",isMask:!0}],["step-out",{position:"a1",spritesheet:"step-out",isMask:!0}],["step-over",{position:"a1",spritesheet:"step-over",isMask:!0}],["step",{position:"a1",spritesheet:"step",isMask:!0}],["stop",{position:"a1",spritesheet:"stop",isMask:!0}],["sync",{position:"a1",spritesheet:"sync",isMask:!0}],["table",{position:"a1",spritesheet:"table",isMask:!0}],["top-panel-close",{position:"a1",spritesheet:"top-panel-close",isMask:!0}],["top-panel-open",{position:"a1",spritesheet:"top-panel-open",isMask:!0}],["triangle-bottom-right",{position:"a1",spritesheet:"triangle-bottom-right",isMask:!0}],["triangle-down",{position:"a1",spritesheet:"triangle-down",isMask:!0}],["triangle-left",{position:"a1",spritesheet:"triangle-left",isMask:!0}],["triangle-right",{position:"a1",spritesheet:"triangle-right",isMask:!0}],["triangle-up",{position:"a1",spritesheet:"triangle-up",isMask:!0}],["undo",{position:"a1",spritesheet:"undo",isMask:!0}],["warning",{position:"a1",spritesheet:"warning",isMask:!0}],["watch",{position:"a1",spritesheet:"watch",isMask:!0}]]);var Oe=Object.freeze({__proto__:null,Icon:Pe});const Be=1e-5;class We{x;y;z;constructor(e,t,i){this.x=e,this.y=t,this.z=i}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){const e=this.length();e<=Be||(this.x/=e,this.y/=e,this.z/=e)}}class Fe{x;y;constructor(e,t){this.x=e,this.y=t}distanceTo(e){return Math.sqrt(Math.pow(e.x-this.x,2)+Math.pow(e.y-this.y,2))}projectOn(e){return 0===e.x&&0===e.y?new Fe(0,0):e.scale((this.x*e.x+this.y*e.y)/(Math.pow(e.x,2)+Math.pow(e.y,2)))}scale(e){return new Fe(this.x*e,this.y*e)}toString(){return Math.round(100*this.x)/100+", "+Math.round(100*this.y)/100}}class He{controlPoints;constructor(e,t){this.controlPoints=[e,t]}static parse(e){const t=He.KeywordValues,i=e.toLowerCase().replace(/\s+/g,"");if(t.has(i))return He.parse(t.get(i));const n=i.match(/^cubic-bezier\(([^,]+),([^,]+),([^,]+),([^,]+)\)$/);if(n){const e=new Fe(parseFloat(n[1]),parseFloat(n[2])),t=new Fe(parseFloat(n[3]),parseFloat(n[4]));return new He(e,t)}return null}evaluateAt(e){function t(e,t,i){return 3*(1-i)*(1-i)*i*e+3*(1-i)*i*i*t+Math.pow(i,3)}const i=t(this.controlPoints[0].x,this.controlPoints[1].x,e),n=t(this.controlPoints[0].y,this.controlPoints[1].y,e);return new Fe(i,n)}asCSSText(){const e="cubic-bezier("+this.controlPoints.join(", ")+")",t=He.KeywordValues;for(const[i,n]of t)if(e===n&&"linear"!==i)return i;return e}static Regex=/((cubic-bezier\([^)]+\))|\b(linear(?![-\(])|ease-in-out|ease-in|ease-out|ease)\b)|(linear\([^)]+\))/g;static KeywordValues=new Map([["linear","cubic-bezier(0, 0, 1, 1)"],["ease","cubic-bezier(0.25, 0.1, 0.25, 1)"],["ease-in","cubic-bezier(0.42, 0, 1, 1)"],["ease-in-out","cubic-bezier(0.42, 0, 0.58, 1)"],["ease-out","cubic-bezier(0, 0, 0.58, 1)"]])}const ze=new He(new Fe(0,0),new Fe(1,1));class Ne{alpha;beta;gamma;constructor(e,t,i){this.alpha=e,this.beta=t,this.gamma=i}static fromDeviceOrientationRotationMatrix(e){let t,i,n;return Math.abs(e.m33)<Be?Math.abs(e.m13)<Be?(t=Math.atan2(e.m12,e.m11),i=e.m23>0?Math.PI/2:-Math.PI/2,n=0):e.m13>0?(t=Math.atan2(-e.m21,e.m22),i=Math.asin(e.m23),n=-Math.PI/2):(t=Math.atan2(e.m21,-e.m22),i=-Math.asin(e.m23),i+=i>0||Math.abs(i)<Be?-Math.PI:Math.PI,n=-Math.PI/2):e.m33>0?(t=Math.atan2(-e.m21,e.m22),i=Math.asin(e.m23),n=Math.atan2(-e.m13,e.m33)):(t=Math.atan2(e.m21,-e.m22),i=-Math.asin(e.m23),i+=i>0||Math.abs(i)<Be?-Math.PI:Math.PI,n=Math.atan2(e.m13,-e.m33)),t<-Be&&(t+=2*Math.PI),t=Number(Ue(t).toFixed(6)),i=Number(Ue(i).toFixed(6)),n=Number(Ue(n).toFixed(6)),new Ne(t,i,n)}}const _e=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},Ve=function(e,t){const i=e.x*t.m14+e.y*t.m24+e.z*t.m34+t.m44,n=(e.x*t.m11+e.y*t.m21+e.z*t.m31+t.m41)/i,s=(e.x*t.m12+e.y*t.m22+e.z*t.m32+t.m42)/i,o=(e.x*t.m13+e.y*t.m23+e.z*t.m33+t.m43)/i;return new We(n,s,o)},Ue=function(e){return 180*e/Math.PI};class Ke{width;height;constructor(e,t){this.width=e,this.height=t}clipTo(e){return e?new Ke(Math.min(this.width,e.width),Math.min(this.height,e.height)):this}scale(e){return new Ke(this.width*e,this.height*e)}isEqual(e){return null!==e&&this.width===e.width&&this.height===e.height}widthToMax(e){return new Ke(Math.max(this.width,"number"==typeof e?e:e.width),this.height)}addWidth(e){return new Ke(this.width+("number"==typeof e?e:e.width),this.height)}heightToMax(e){return new Ke(this.width,Math.max(this.height,"number"==typeof e?e:e.height))}addHeight(e){return new Ke(this.width,this.height+("number"==typeof e?e:e.height))}}class je{minimum;preferred;constructor(e,t){if(this.minimum=e||new Ke(0,0),this.preferred=t||this.minimum,this.minimum.width>this.preferred.width||this.minimum.height>this.preferred.height)throw new Error("Minimum size is greater than preferred.")}isEqual(e){return null!==e&&this.minimum.isEqual(e.minimum)&&this.preferred.isEqual(e.preferred)}widthToMax(e){return"number"==typeof e?new je(this.minimum.widthToMax(e),this.preferred.widthToMax(e)):new je(this.minimum.widthToMax(e.minimum),this.preferred.widthToMax(e.preferred))}addWidth(e){return"number"==typeof e?new je(this.minimum.addWidth(e),this.preferred.addWidth(e)):new je(this.minimum.addWidth(e.minimum),this.preferred.addWidth(e.preferred))}heightToMax(e){return"number"==typeof e?new je(this.minimum.heightToMax(e),this.preferred.heightToMax(e)):new je(this.minimum.heightToMax(e.minimum),this.preferred.heightToMax(e.preferred))}addHeight(e){return"number"==typeof e?new je(this.minimum.addHeight(e),this.preferred.addHeight(e)):new je(this.minimum.addHeight(e.minimum),this.preferred.addHeight(e.preferred))}}var qe=Object.freeze({__proto__:null,_Eps:Be,Vector:We,Point:Fe,CubicBezier:He,LINEAR_BEZIER:ze,EulerAngles:Ne,scalarProduct:_e,crossProduct:function(e,t){const i=e.y*t.z-e.z*t.y,n=e.z*t.x-e.x*t.z,s=e.x*t.y-e.y*t.x;return new We(i,n,s)},subtract:function(e,t){const i=e.x-t.x,n=e.y-t.y,s=e.z-t.z;return new We(i,n,s)},multiplyVectorByMatrixAndNormalize:Ve,calculateAngle:function(e,t){const i=e.length(),n=t.length();if(i<=Be||n<=Be)return 0;const s=_e(e,t)/i/n;return Math.abs(s)>1?0:Ue(Math.acos(s))},degreesToRadians:function(e){return e*Math.PI/180},degreesToGradians:function(e){return e/9*10},degreesToTurns:function(e){return e/360},radiansToDegrees:Ue,radiansToGradians:function(e){return 200*e/Math.PI},radiansToTurns:function(e){return e/(2*Math.PI)},gradiansToRadians:function(e){return e*Math.PI/200},turnsToRadians:function(e){return 2*e*Math.PI},boundsForTransformedPoints:function(e,t,i){i||(i={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0}),t.length%3&&console.warn("Invalid size of points array");for(let n=0;n<t.length;n+=3){let s=new We(t[n],t[n+1],t[n+2]);s=Ve(s,e),i.minX=Math.min(i.minX,s.x),i.maxX=Math.max(i.maxX,s.x),i.minY=Math.min(i.minY,s.y),i.maxY=Math.max(i.maxY,s.y)}return i},Size:Ke,Constraints:je});class Ge{descriptors;action;type;keybindSets;constructor(e,t,i,n){this.descriptors=e,this.action=t,this.type=i,this.keybindSets=n||new Set}title(){return this.descriptors.map((e=>e.name)).join(" ")}isDefault(){return this.type===rt.DefaultShortcut||this.type===rt.DisabledDefault||this.type===rt.KeybindSetShortcut&&this.keybindSets.has(oo)}changeType(e){return new Ge(this.descriptors,this.action,e)}changeKeys(e){return this.descriptors=e,this}descriptorsMatch(e){return e.length===this.descriptors.length&&e.every(((e,t)=>e.key===this.descriptors[t].key))}hasKeybindSet(e){return!this.keybindSets||this.keybindSets.has(e)}equals(e){return this.descriptorsMatch(e.descriptors)&&this.type===e.type&&this.action===e.action}static createShortcutFromSettingObject(e){return new Ge(e.descriptors,e.action,e.type)}static makeKey(e,t){return"string"==typeof e&&(e=e.charCodeAt(0)-(/^[a-z]/.test(e)?32:0)),t=t||Xe.None,Ge.makeKeyFromCodeAndModifiers(e,t)}static makeKeyFromEvent(e){let t=Xe.None;e.shiftKey&&(t|=Xe.Shift),e.ctrlKey&&(t|=Xe.Ctrl),e.altKey&&(t|=Xe.Alt),e.metaKey&&(t|=Xe.Meta);const i=e.keyCode||e.__keyCode;return Ge.makeKeyFromCodeAndModifiers(i,t)}static makeKeyFromEventIgnoringModifiers(e){const t=e.keyCode||e.__keyCode;return Ge.makeKeyFromCodeAndModifiers(t,Xe.None)}static eventHasCtrlEquivalentKey(e){return s.Platform.isMac()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}static eventHasEitherCtrlOrMeta(e){return e.metaKey||e.ctrlKey}static hasNoModifiers(e){const t=e;return!(t.ctrlKey||t.shiftKey||t.altKey||t.metaKey)}static makeDescriptor(e,t){return{key:Ge.makeKey("string"==typeof e?e:e.code,t),name:Ge.shortcutToString(e,t)}}static makeDescriptorFromBindingShortcut(e){const[t,...i]=e.split(/\+(?!$)/).reverse();let n=0;for(const t of i){const i=Xe[t];console.assert(void 0!==i,`Only one key other than modifier is allowed in shortcut <${e}>`),n|=i}console.assert(t.length>0,`Modifiers-only shortcuts are not allowed (encountered <${e}>)`);const s=ot[t]||at[t];return s&&"shiftKey"in s&&s.shiftKey&&(n|=Xe.Shift),Ge.makeDescriptor(s||t,n)}static shortcutToString(e,t){return"string"!=typeof e&&Ge.isModifier(e.code)?Ge.modifiersToString(t):Ge.modifiersToString(t)+Ge.keyName(e)}static keyName(e){return"string"==typeof e?e.toUpperCase():"string"==typeof e.name?e.name:e.name[s.Platform.platform()]||e.name.other||""}static makeKeyFromCodeAndModifiers(e,t){return 255&e|(t||0)<<8}static keyCodeAndModifiersFromKey(e){return{keyCode:255&e,modifiers:e>>8}}static isModifier(e){const{keyCode:t}=Ge.keyCodeAndModifiersFromKey(e);return t===ot.Shift.code||t===ot.Ctrl.code||t===ot.Alt.code||t===ot.Meta.code}static modifiersToString(e){const t=s.Platform.isMac(),i=Xe,n=new Map([[i.Ctrl,t?"Ctrl ":"Ctrl + "],[i.Alt,t?"⌥ ":"Alt + "],[i.Shift,t?"⇧ ":"Shift + "],[i.Meta,t?"⌘ ":"Win + "]]);return[i.Meta,i.Ctrl,i.Alt,i.Shift].map((function(t){return(e||0)&t?n.get(t):""})).join("")}}const Xe={None:0,Shift:1,Ctrl:2,Alt:4,Meta:8,CtrlOrMeta:s.Platform.isMac()?8:2,ShiftOrOption:s.Platform.isMac()?4:1},Ye={code:37,name:"←"},$e={code:38,name:"↑"},Qe={code:39,name:"→"},Ze={code:40,name:"↓"},Je={code:17,name:"Ctrl"},et={code:27,name:"Esc"},tt={code:32,name:"Space"},it={code:187,name:"+"},nt={code:192,name:"`"},st={code:222,name:"'"},ot={Backspace:{code:8,name:"↤"},Tab:{code:9,name:{mac:"⇥",other:"Tab"}},Enter:{code:13,name:{mac:"↩",other:"Enter"}},Shift:{code:16,name:{mac:"⇧",other:"Shift"}},Ctrl:Je,Control:Je,Alt:{code:18,name:"Alt"},Esc:et,Escape:et,Space:tt," ":tt,PageUp:{code:33,name:{mac:"⇞",other:"PageUp"}},PageDown:{code:34,name:{mac:"⇟",other:"PageDown"}},End:{code:35,name:{mac:"↗",other:"End"}},Home:{code:36,name:{mac:"↖",other:"Home"}},Left:Ye,Up:$e,Right:Qe,Down:Ze,ArrowLeft:Ye,ArrowUp:$e,ArrowRight:Qe,ArrowDown:Ze,Delete:{code:46,name:"Del"},Zero:{code:48,name:"0"},H:{code:72,name:"H"},N:{code:78,name:"N"},P:{code:80,name:"P"},Meta:{code:91,name:"Meta"},F1:{code:112,name:"F1"},F2:{code:113,name:"F2"},F3:{code:114,name:"F3"},F4:{code:115,name:"F4"},F5:{code:116,name:"F5"},F6:{code:117,name:"F6"},F7:{code:118,name:"F7"},F8:{code:119,name:"F8"},F9:{code:120,name:"F9"},F10:{code:121,name:"F10"},F11:{code:122,name:"F11"},F12:{code:123,name:"F12"},Semicolon:{code:186,name:";"},NumpadPlus:{code:107,name:"Numpad +"},NumpadMinus:{code:109,name:"Numpad -"},Numpad0:{code:96,name:"Numpad 0"},Plus:it,Equal:it,Comma:{code:188,name:","},Minus:{code:189,name:"-"},Period:{code:190,name:"."},Slash:{code:191,name:"/"},QuestionMark:{code:191,name:"?"},Apostrophe:nt,Tilde:{code:192,name:"Tilde"},Backquote:nt,IntlBackslash:nt,LeftSquareBracket:{code:219,name:"["},RightSquareBracket:{code:221,name:"]"},Backslash:{code:220,name:"\\"},SingleQuote:st,Quote:st,get CtrlOrMeta(){return s.Platform.isMac()?this.Meta:this.Ctrl}};var rt;!function(e){e.UserShortcut="UserShortcut",e.DefaultShortcut="DefaultShortcut",e.DisabledDefault="DisabledDefault",e.UnsetShortcut="UnsetShortcut",e.KeybindSetShortcut="KeybindSetShortcut"}(rt||(rt={}));const at={};!function(){for(const e in ot){const t=ot[e];if("object"==typeof t&&t.code){const i="string"==typeof t.name?t.name:e;at[i]=t}}}();var lt=Object.freeze({__proto__:null,KeyboardShortcut:Ge,Modifiers:Xe,Keys:ot,get Type(){return rt},KeyBindings:at});const ht={close:"Close",dockToRight:"Dock to right",dockToBottom:"Dock to bottom",dockToLeft:"Dock to left",undockIntoSeparateWindow:"Undock into separate window",devtoolsUndocked:"DevTools is undocked",devToolsDockedTo:"DevTools is docked to {PH1}"},dt=t.i18n.registerUIStrings("ui/legacy/DockController.ts",ht),ct=t.i18n.getLocalizedString.bind(void 0,dt);let ut;class mt extends e.ObjectWrapper.ObjectWrapper{canDockInternal;closeButton;currentDockStateSetting;lastDockStateSetting;dockSideInternal=void 0;titles;savedFocus;constructor(t){if(super(),this.canDockInternal=t,this.closeButton=new Pn(ct(ht.close),"cross"),this.closeButton.element.classList.add("close-devtools"),this.closeButton.addEventListener(Pn.Events.Click,s.InspectorFrontendHost.InspectorFrontendHostInstance.closeWindow.bind(s.InspectorFrontendHost.InspectorFrontendHostInstance)),this.currentDockStateSetting=e.Settings.Settings.instance().moduleSetting("currentDockState"),this.lastDockStateSetting=e.Settings.Settings.instance().createSetting("lastDockState","bottom"),!t)return this.dockSideInternal="undocked",void this.closeButton.setVisible(!1);this.currentDockStateSetting.addChangeListener(this.dockSideChanged,this),-1===pt.indexOf(this.currentDockStateSetting.get())&&this.currentDockStateSetting.set("right"),-1===pt.indexOf(this.lastDockStateSetting.get())&&this.currentDockStateSetting.set("bottom")}static instance(e={forceNew:null,canDock:!1}){const{forceNew:t,canDock:i}=e;return ut&&!t||(ut=new mt(i)),ut}initialize(){this.canDockInternal&&(this.titles=[ct(ht.dockToRight),ct(ht.dockToBottom),ct(ht.dockToLeft),ct(ht.undockIntoSeparateWindow)],this.dockSideChanged())}dockSideChanged(){this.setDockSide(this.currentDockStateSetting.get()),setTimeout(this.announceDockLocation.bind(this),2e3)}dockSide(){return this.dockSideInternal}canDock(){return this.canDockInternal}isVertical(){return"right"===this.dockSideInternal||"left"===this.dockSideInternal}setDockSide(e){if(-1===pt.indexOf(e)&&(e=pt[0]),this.dockSideInternal===e)return;void 0!==this.dockSideInternal&&document.body.classList.remove(this.dockSideInternal),document.body.classList.add(e),this.dockSideInternal&&this.lastDockStateSetting.set(this.dockSideInternal),this.savedFocus=n.DOMUtilities.deepActiveElement(document);const t={from:this.dockSideInternal,to:e};this.dispatchEventToListeners("BeforeDockSideChanged",t),console.timeStamp("DockController.setIsDocked"),this.dockSideInternal=e,this.currentDockStateSetting.set(e),s.InspectorFrontendHost.InspectorFrontendHostInstance.setIsDocked("undocked"!==e,this.setIsDockedResponse.bind(this,t)),this.closeButton.setVisible("undocked"!==this.dockSideInternal),this.dispatchEventToListeners("DockSideChanged",t)}setIsDockedResponse(e){this.dispatchEventToListeners("AfterDockSideChanged",e),this.savedFocus&&(this.savedFocus.focus(),this.savedFocus=null)}toggleDockSide(){if(this.lastDockStateSetting.get()===this.currentDockStateSetting.get()){const e=pt.indexOf(this.currentDockStateSetting.get())||0;this.lastDockStateSetting.set(pt[(e+1)%pt.length])}this.setDockSide(this.lastDockStateSetting.get())}announceDockLocation(){"undocked"===this.dockSideInternal?ke(ct(ht.devtoolsUndocked)):ke(ct(ht.devToolsDockedTo,{PH1:this.dockSideInternal||""}))}}const pt=["right","bottom","left","undocked"];let gt,bt;class ft{static instance(e={forceNew:null}){const{forceNew:t}=e;return gt&&!t||(gt=new ft),gt}handleAction(e,t){return mt.instance().toggleDockSide(),!0}}class vt{static instance(e={forceNew:null}){const{forceNew:t}=e;return bt&&!t||(bt=new vt),bt}item(){return mt.instance().closeButton}}var wt=Object.freeze({__proto__:null,DockController:mt,ToggleDockActionDelegate:ft,CloseButtonProvider:vt}),xt={cssContent:".infobar{color:var(--color-text-primary);display:flex;flex:auto;border-bottom:1px solid var(--color-details-hairline);flex-direction:column;position:relative;padding:1px 6px}.infobar:focus{box-shadow:0 0 0 2px var(--color-background-elevation-2) inset}.infobar-warning{--override-infobar-warning-background:rgb(253 242 192);background-color:var(--override-infobar-warning-background)}.infobar-error{--override-infobar-error-background:var(--color-error-background);--override-infobar-error-text:var(--color-error-text);background-color:var(--override-infobar-error-background);color:var(--override-infobar-error-text)}.-theme-with-dark-background .infobar-warning,\n:host-context(.-theme-with-dark-background) .infobar-warning{--override-infobar-warning-background:rgb(63 52 2)}.infobar-main-row{display:flex;flex-direction:row;justify-content:flex-start;min-height:25px}.infobar-info-container{display:flex;align-items:center;flex-grow:1;flex-wrap:wrap}.infobar-info-message{display:flex;margin:5px 0}.infobar-info-text{display:flex;align-items:center;margin:0 4px}.infobar-details-rows{padding:5px 5px 0}.infobar-details-row{display:flex;flex-direction:column;line-height:18px;padding-bottom:6px}.infobar-close-container{display:flex;flex-shrink:0;align-items:center}.infobar-close-container > .infobar-button.link-style{margin:4px}.infobar-selectable{user-select:text}.infobar-button{color:var(--color-text-secondary);cursor:pointer;padding:0 4px}.info-icon{-webkit-mask-image:var(--image-file-info);background-color:var(--icon-info)}.warning-icon{-webkit-mask-image:var(--image-file-warning);background-color:var(--icon-warning)}.error-icon{-webkit-mask-image:var(--image-file-cross-circle);background-color:var(--icon-error)}.issue-icon{-webkit-mask-image:var(--image-file-issue-text-filled);background-color:var(--icon-info)}.icon{-webkit-mask-size:20px 20px;width:20px;height:20px;flex-shrink:0}.devtools-link.text-button:hover,\n.devtools-link.text-button:focus,\n.devtools-link.text-button:active{background-color:transparent;box-shadow:none}"};const Et={dontShowAgain:"Don't show again",learnMore:"Learn more",close:"Close"},It=t.i18n.registerUIStrings("ui/legacy/Infobar.ts",Et),St=t.i18n.getLocalizedString.bind(void 0,It);class yt{element;shadowRoot;contentElement;mainRow;detailsRows;hasDetails;detailsMessage;infoContainer;infoMessage;infoText;actionContainer;disableSetting;closeContainer;toggleElement;closeButton;closeCallback;#e=null;parentView;constructor(e,t,i,n){if(this.element=document.createElement("div"),this.element.classList.add("flex-none"),this.shadowRoot=o.createShadowRootWithCoreStyles(this.element,{cssFile:xt,delegatesFocus:void 0}),this.contentElement=this.shadowRoot.createChild("div","infobar infobar-"+e),this.mainRow=this.contentElement.createChild("div","infobar-main-row"),this.detailsRows=this.contentElement.createChild("div","infobar-details-rows hidden"),this.hasDetails=!1,this.detailsMessage="",this.infoContainer=this.mainRow.createChild("div","infobar-info-container"),this.infoMessage=this.infoContainer.createChild("div","infobar-info-message"),this.infoMessage.createChild("div",e+"-icon icon"),this.infoText=this.infoMessage.createChild("div","infobar-info-text"),this.infoText.textContent=t,O(this.infoText),this.actionContainer=this.infoContainer.createChild("div","infobar-info-actions"),i){this.contentElement.setAttribute("role","group");for(const e of i){const t=this.actionCallbackFactory(e);let i="infobar-button";e.highlight&&(i+=" primary-button");const n=Is(e.text,t,i);e.highlight&&!this.#e&&(this.#e=n),this.actionContainer.appendChild(n)}}if(this.disableSetting=n||null,n){const e=Is(St(Et.dontShowAgain),this.onDisable.bind(this),"infobar-button");this.actionContainer.appendChild(e)}this.closeContainer=this.mainRow.createChild("div","infobar-close-container"),this.toggleElement=Is(St(Et.learnMore),this.onToggleDetails.bind(this),"link-style devtools-link hidden"),this.toggleElement.setAttribute("role","link"),this.closeContainer.appendChild(this.toggleElement),this.closeButton=this.closeContainer.createChild("div","close-button","dt-close-button"),this.closeButton.setTabbable(!0),fe(this.closeButton,St(Et.close)),self.onInvokeElement(this.closeButton,this.dispose.bind(this)),e!==Ct.Issue&&(this.contentElement.tabIndex=0),be(this.contentElement,t),this.contentElement.addEventListener("keydown",(e=>e.keyCode===ot.Esc.code?(this.dispose(),void e.consume()):e.target===this.contentElement&&"Enter"===e.key&&this.hasDetails?(this.onToggleDetails(),void e.consume()):void 0)),this.closeCallback=null}static create(e,t,i,n){return n&&n.get()?null:new yt(e,t,i,n)}dispose(){this.element.remove(),this.onResize(),this.closeCallback&&this.closeCallback.call(null)}setText(e){this.infoText.textContent=e,this.onResize()}setCloseCallback(e){this.closeCallback=e}setParentView(e){this.parentView=e}actionCallbackFactory(e){return e.delegate?e.dismiss?(()=>{e.delegate&&e.delegate(),this.dispose()}).bind(this):e.delegate:e.dismiss?this.dispose.bind(this):()=>{}}onResize(){this.parentView&&this.parentView.doResize()}onDisable(){this.disableSetting&&this.disableSetting.set(!0),this.dispose()}onToggleDetails(){this.detailsRows.classList.remove("hidden"),this.toggleElement.remove(),this.onResize(),ke("string"==typeof this.detailsMessage?this.detailsMessage:this.detailsMessage.textContent||""),this.#e?this.#e.focus():this.closeButton.focus()}createDetailsRowMessage(e){this.hasDetails=!0,this.detailsMessage=e,this.toggleElement.classList.remove("hidden");const t=this.detailsRows.createChild("div","infobar-details-row").createChild("span","infobar-row-message");return"string"==typeof e?t.textContent=e:t.appendChild(e),t}}var Ct;!function(e){e.Warning="warning",e.Info="info",e.Issue="issue",e.Error="error"}(Ct||(Ct={}));var kt,Tt=Object.freeze({__proto__:null,Infobar:yt,get Type(){return Ct}});class Mt extends e.ObjectWrapper.ObjectWrapper{isEnabledInternal;elementsInternal;installDragOnMouseDownBound;cursorInternal;startX;startY;constructor(){super(),this.isEnabledInternal=!0,this.elementsInternal=new Set,this.installDragOnMouseDownBound=this.installDragOnMouseDown.bind(this),this.cursorInternal="nwse-resize"}isEnabled(){return this.isEnabledInternal}setEnabled(e){this.isEnabledInternal=e,this.updateElementCursors()}elements(){return[...this.elementsInternal]}addElement(e){this.elementsInternal.has(e)||(this.elementsInternal.add(e),e.addEventListener("pointerdown",this.installDragOnMouseDownBound,!1),this.updateElementCursor(e))}removeElement(e){this.elementsInternal.has(e)&&(this.elementsInternal.delete(e),e.removeEventListener("pointerdown",this.installDragOnMouseDownBound,!1),e.style.removeProperty("cursor"))}updateElementCursors(){this.elementsInternal.forEach(this.updateElementCursor.bind(this))}updateElementCursor(e){this.isEnabledInternal?(e.style.setProperty("cursor",this.cursor()),e.style.setProperty("touch-action","none")):(e.style.removeProperty("cursor"),e.style.removeProperty("touch-action"))}cursor(){return this.cursorInternal}setCursor(e){this.cursorInternal=e,this.updateElementCursors()}installDragOnMouseDown(e){const t=e.target;if(!this.elementsInternal.has(t))return!1;Zn(t,this.dragStart.bind(this),(e=>{this.drag(e)}),this.dragEnd.bind(this),this.cursor(),e)}dragStart(e){return!!this.isEnabledInternal&&(this.startX=e.pageX,this.startY=e.pageY,this.sendDragStart(this.startX,this.startY),!0)}sendDragStart(e,t){this.dispatchEventToListeners(kt.ResizeStart,{startX:e,currentX:e,startY:t,currentY:t})}drag(e){return this.isEnabledInternal?(this.sendDragMove(this.startX,e.pageX,this.startY,e.pageY,e.shiftKey),e.preventDefault(),!1):(this.dragEnd(e),!0)}sendDragMove(e,t,i,n,s){this.dispatchEventToListeners(kt.ResizeUpdateXY,{startX:e,currentX:t,startY:i,currentY:n,shiftKey:s})}dragEnd(e){this.dispatchEventToListeners(kt.ResizeEnd),delete this.startX,delete this.startY}}!function(e){e.ResizeStart="ResizeStart",e.ResizeUpdateXY="ResizeUpdateXY",e.ResizeUpdatePosition="ResizeUpdatePosition",e.ResizeEnd="ResizeEnd"}(kt||(kt={}));class Lt extends Mt{isVerticalInternal;constructor(){super(),this.isVerticalInternal=!0}isVertical(){return this.isVerticalInternal}setVertical(e){this.isVerticalInternal=e,this.updateElementCursors()}cursor(){return this.isVerticalInternal?"ns-resize":"ew-resize"}sendDragStart(e,t){const i=this.isVerticalInternal?t:e;this.dispatchEventToListeners(kt.ResizeStart,{startPosition:i,currentPosition:i})}sendDragMove(e,t,i,n,s){this.isVerticalInternal?this.dispatchEventToListeners(kt.ResizeUpdatePosition,{startPosition:i,currentPosition:n,shiftKey:s}):this.dispatchEventToListeners(kt.ResizeUpdatePosition,{startPosition:e,currentPosition:t,shiftKey:s})}}var Pt=Object.freeze({__proto__:null,ResizerWidget:Mt,get Events(){return kt},SimpleResizerWidget:Lt});class Dt extends HTMLElement{static get observedAttributes(){return["flex","padding","padding-top","padding-bottom","padding-left","padding-right","margin","margin-top","margin-bottom","margin-left","margin-right","overflow","overflow-x","overflow-y","font-size","color","background","background-color","border","border-top","border-bottom","border-left","border-right","max-width","max-height"]}attributeChangedCallback(e,t,i){if("flex"!==e)if(null===i){if(this.style.removeProperty(e),e.startsWith("padding-")||e.startsWith("margin-")||e.startsWith("border-")||e.startsWith("background-")||e.startsWith("overflow-")){const t=e.substring(0,e.indexOf("-")),i=this.getAttribute(t);null!==i&&this.style.setProperty(t,i)}}else this.style.setProperty(e,i);else null===i?this.style.removeProperty("flex"):"initial"===i||"auto"===i||"none"===i||-1!==i.indexOf(" ")?this.style.setProperty("flex",i):this.style.setProperty("flex","0 0 "+i)}}class Rt extends Dt{constructor(e){super(),this.style.setProperty("display","flex"),this.style.setProperty("flex-direction",e),this.style.setProperty("justify-content","flex-start")}static get observedAttributes(){return super.observedAttributes.concat(["x-start","x-center","x-stretch","x-baseline","justify-content"])}attributeChangedCallback(e,t,i){"x-start"!==e&&"x-center"!==e&&"x-stretch"!==e&&"x-baseline"!==e?super.attributeChangedCallback(e,t,i):null===i?this.style.removeProperty("align-items"):this.style.setProperty("align-items","x-start"===e?"flex-start":e.substr(2))}}d.CustomElements.defineComponent("x-vbox",class extends Rt{constructor(){super("column")}}),d.CustomElements.defineComponent("x-hbox",class extends Rt{constructor(){super("row")}}),d.CustomElements.defineComponent("x-cbox",class extends Dt{constructor(){super(),this.style.setProperty("display","flex"),this.style.setProperty("flex-direction","column"),this.style.setProperty("justify-content","center"),this.style.setProperty("align-items","center")}}),d.CustomElements.defineComponent("x-div",class extends Dt{constructor(){super(),this.style.setProperty("display","block")}}),d.CustomElements.defineComponent("x-span",class extends Dt{constructor(){super(),this.style.setProperty("display","inline")}}),d.CustomElements.defineComponent("x-text",class extends Dt{constructor(){super(),this.style.setProperty("display","inline"),this.style.setProperty("white-space","pre")}});var At=Object.freeze({__proto__:null,XElement:Dt});let Ot=null;const Bt=new WeakMap;class Wt extends Dt{visible;shadowRootInternal;defaultFocusedElement;elementsToRestoreScrollPositionsFor;onShownCallback;onHiddenCallback;onResizedCallback;constructor(){super(),this.style.setProperty("display","flex"),this.style.setProperty("flex-direction","column"),this.style.setProperty("align-items","stretch"),this.style.setProperty("justify-content","flex-start"),this.style.setProperty("contain","layout style"),this.visible=!1,this.defaultFocusedElement=null,this.elementsToRestoreScrollPositionsFor=[],Ot||(Ot=new ResizeObserver((e=>{for(const t of e){const e=t.target;e.visible&&e.onResizedCallback&&e.onResizedCallback.call(null)}}))),Ot.observe(this),this.setElementsToRestoreScrollPositionsFor([this])}isShowing(){return this.visible}setOnShown(e){this.onShownCallback=e}setOnHidden(e){this.onHiddenCallback=e}setOnResized(e){this.onResizedCallback=e}setElementsToRestoreScrollPositionsFor(e){for(const e of this.elementsToRestoreScrollPositionsFor)e.removeEventListener("scroll",Wt.storeScrollPosition,{capture:!1});this.elementsToRestoreScrollPositionsFor=e;for(const e of this.elementsToRestoreScrollPositionsFor)e.addEventListener("scroll",Wt.storeScrollPosition,{passive:!0,capture:!1})}restoreScrollPositions(){for(const e of this.elementsToRestoreScrollPositionsFor){const t=Bt.get(e);t&&(e.scrollTop=t.scrollTop,e.scrollLeft=t.scrollLeft)}}static storeScrollPosition(e){const t=e.currentTarget;Bt.set(t,{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop})}setDefaultFocusedElement(e){if(e&&!this.isSelfOrAncestor(e))throw new Error("Default focus must be descendant");this.defaultFocusedElement=e}focus(){if(!this.visible)return;let e;if(this.defaultFocusedElement&&this.isSelfOrAncestor(this.defaultFocusedElement))e=this.defaultFocusedElement;else if(-1!==this.tabIndex)e=this;else{let t=this.traverseNextNode(this);for(;t;){if(t instanceof Wt&&t.visible){e=t;break}t=t.traverseNextNode(this)}}e&&!e.hasFocus()&&(e===this?HTMLElement.prototype.focus.call(this):e.focus())}connectedCallback(){this.visible=!0,this.restoreScrollPositions(),this.onShownCallback&&this.onShownCallback.call(null)}disconnectedCallback(){this.visible=!1,this.onHiddenCallback&&this.onHiddenCallback.call(null)}}d.CustomElements.defineComponent("x-widget",Wt);var Ft=Object.freeze({__proto__:null,XWidget:Wt});class Ht extends HTMLDivElement{__widget;__widgetCounter;constructor(){super()}}class zt{element;contentElement;shadowRoot;isWebComponent;visibleInternal;isRoot;isShowingInternal;childrenInternal;hideOnDetach;notificationDepth;invalidationsSuspended;defaultFocusedChild;parentWidgetInternal;registeredCSSFiles;defaultFocusedElement;cachedConstraints;constraintsInternal;invalidationsRequested;externallyManaged;constructor(e,t){this.contentElement=document.createElement("div"),this.contentElement.classList.add("widget"),e?(this.element=document.createElement("div"),this.element.classList.add("vbox"),this.element.classList.add("flex-auto"),this.shadowRoot=o.createShadowRootWithCoreStyles(this.element,{cssFile:void 0,delegatesFocus:t}),this.shadowRoot.appendChild(this.contentElement)):this.element=this.contentElement,this.isWebComponent=e,this.element.__widget=this,this.visibleInternal=!1,this.isRoot=!1,this.isShowingInternal=!1,this.childrenInternal=[],this.hideOnDetach=!1,this.notificationDepth=0,this.invalidationsSuspended=0,this.defaultFocusedChild=null,this.parentWidgetInternal=null,this.registeredCSSFiles=!1}static incrementWidgetCounter(e,t){const i=(t.__widgetCounter||0)+(t.__widget?1:0);if(!i)return;let n=e;for(;n;)n.__widgetCounter=(n.__widgetCounter||0)+i,n=Kt(n)}static decrementWidgetCounter(e,t){const i=(t.__widgetCounter||0)+(t.__widget?1:0);if(!i)return;let n=e;for(;n;)n.__widgetCounter&&(n.__widgetCounter-=i),n=Kt(n)}static assert(e,t){if(!e)throw new Error(t)}markAsRoot(){zt.assert(!this.element.parentElement,"Attempt to mark as root attached node"),this.isRoot=!0}parentWidget(){return this.parentWidgetInternal}children(){return this.childrenInternal}childWasDetached(e){}isShowing(){return this.isShowingInternal}shouldHideOnDetach(){if(!this.element.parentElement)return!1;if(this.hideOnDetach)return!0;for(const e of this.childrenInternal)if(e.shouldHideOnDetach())return!0;return!1}setHideOnDetach(){this.hideOnDetach=!0}inNotification(){return Boolean(this.notificationDepth)||Boolean(this.parentWidgetInternal&&this.parentWidgetInternal.inNotification())}parentIsShowing(){return!!this.isRoot||null!==this.parentWidgetInternal&&this.parentWidgetInternal.isShowing()}callOnVisibleChildren(e){const t=this.childrenInternal.slice();for(let i=0;i<t.length;++i)t[i].parentWidgetInternal===this&&t[i].visibleInternal&&e.call(t[i])}processWillShow(){this.callOnVisibleChildren(this.processWillShow),this.isShowingInternal=!0}processWasShown(){this.inNotification()||(this.restoreScrollPositions(),this.notify(this.wasShown),this.callOnVisibleChildren(this.processWasShown))}processWillHide(){this.inNotification()||(this.storeScrollPositions(),this.callOnVisibleChildren(this.processWillHide),this.notify(this.willHide),this.isShowingInternal=!1)}processWasHidden(){this.callOnVisibleChildren(this.processWasHidden)}processOnResize(){this.inNotification()||this.isShowing()&&(this.notify(this.onResize),this.callOnVisibleChildren(this.processOnResize))}notify(e){++this.notificationDepth;try{e.call(this)}finally{--this.notificationDepth}}wasShown(){}willHide(){}onResize(){}onLayout(){}async ownerViewDisposed(){}show(e,t){if(zt.assert(e,"Attempt to attach widget with no parent element"),!this.isRoot){let t=e;for(;t&&!t.__widget;)t=Kt(t);if(!t||!t.__widget)throw new Error("Attempt to attach widget to orphan node");this.attach(t.__widget)}this.showWidgetInternal(e,t)}attach(e){e!==this.parentWidgetInternal&&(this.parentWidgetInternal&&this.detach(),this.parentWidgetInternal=e,this.parentWidgetInternal.childrenInternal.push(this),this.isRoot=!1)}showWidget(){if(!this.visibleInternal){if(!this.element.parentElement)throw new Error("Attempt to show widget that is not hidden using hideWidget().");this.showWidgetInternal(this.element.parentElement,this.element.nextSibling)}}showWidgetInternal(e,t){let i=e;for(;i&&!i.__widget;)i=Kt(i);this.isRoot?zt.assert(!i,"Attempt to show root widget under another widget"):zt.assert(i&&i.__widget===this.parentWidgetInternal,"Attempt to show under node belonging to alien widget");const n=this.visibleInternal;n&&this.element.parentElement===e||(this.visibleInternal=!0,!n&&this.parentIsShowing()&&this.processWillShow(),this.element.classList.remove("hidden"),this.element.parentElement!==e&&(this.externallyManaged||zt.incrementWidgetCounter(e,this.element),t?h.DOMExtension.originalInsertBefore.call(e,this.element,t):h.DOMExtension.originalAppendChild.call(e,this.element)),!n&&this.parentIsShowing()&&this.processWasShown(),this.parentWidgetInternal&&this.hasNonZeroConstraints()?this.parentWidgetInternal.invalidateConstraints():this.processOnResize())}hideWidget(){this.visibleInternal&&this.hideWidgetInternal(!1)}hideWidgetInternal(e){this.visibleInternal=!1;const t=this.element.parentElement;this.parentIsShowing()&&this.processWillHide(),e?(zt.decrementWidgetCounter(t,this.element),h.DOMExtension.originalRemoveChild.call(t,this.element)):this.element.classList.add("hidden"),this.parentIsShowing()&&this.processWasHidden(),this.parentWidgetInternal&&this.hasNonZeroConstraints()&&this.parentWidgetInternal.invalidateConstraints()}detach(e){if(!this.parentWidgetInternal&&!this.isRoot)return;const t=e||!this.shouldHideOnDetach();if(this.visibleInternal)this.hideWidgetInternal(t);else if(t&&this.element.parentElement){const e=this.element.parentElement;zt.decrementWidgetCounter(e,this.element),h.DOMExtension.originalRemoveChild.call(e,this.element)}if(this.parentWidgetInternal){const e=this.parentWidgetInternal.childrenInternal.indexOf(this);zt.assert(e>=0,"Attempt to remove non-child widget"),this.parentWidgetInternal.childrenInternal.splice(e,1),this.parentWidgetInternal.defaultFocusedChild===this&&(this.parentWidgetInternal.defaultFocusedChild=null),this.parentWidgetInternal.childWasDetached(this),this.parentWidgetInternal=null}else zt.assert(this.isRoot,"Removing non-root widget from DOM")}detachChildWidgets(){const e=this.childrenInternal.slice();for(let t=0;t<e.length;++t)e[t].detach()}elementsToRestoreScrollPositionsFor(){return[this.element]}storeScrollPositions(){const e=this.elementsToRestoreScrollPositionsFor();for(const t of e)Nt.set(t,{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop})}restoreScrollPositions(){const e=this.elementsToRestoreScrollPositionsFor();for(const t of e){const e=Nt.get(t);e&&(t.scrollLeft=e.scrollLeft,t.scrollTop=e.scrollTop)}}doResize(){this.isShowing()&&(this.inNotification()||this.callOnVisibleChildren(this.processOnResize))}doLayout(){this.isShowing()&&(this.notify(this.onLayout),this.doResize())}registerRequiredCSS(e){this.isWebComponent?c.ThemeSupport.instance().appendStyle(this.shadowRoot,e):c.ThemeSupport.instance().appendStyle(this.element,e)}registerCSSFiles(e){let t;t=this.isWebComponent&&void 0!==this.shadowRoot?this.shadowRoot:d.GetRootNode.getRootNode(this.contentElement),t.adoptedStyleSheets=t.adoptedStyleSheets.concat(e),this.registeredCSSFiles=!0}printWidgetHierarchy(){const e=[];this.collectWidgetHierarchy("",e),console.log(e.join("\n"))}collectWidgetHierarchy(e,t){t.push(e+"["+this.element.className+"]"+(this.childrenInternal.length?" {":""));for(let i=0;i<this.childrenInternal.length;++i)this.childrenInternal[i].collectWidgetHierarchy(e+"    ",t);this.childrenInternal.length&&t.push(e+"}")}setDefaultFocusedElement(e){this.defaultFocusedElement=e}setDefaultFocusedChild(e){zt.assert(e.parentWidgetInternal===this,"Attempt to set non-child widget as default focused."),this.defaultFocusedChild=e}focus(){if(!this.isShowing())return;const e=this.defaultFocusedElement;if(e)e.hasFocus()||e.focus();else if(this.defaultFocusedChild&&this.defaultFocusedChild.visibleInternal)this.defaultFocusedChild.focus();else{for(const e of this.childrenInternal)if(e.visibleInternal)return void e.focus();let e=this.contentElement.traverseNextNode(this.contentElement);for(;e;){if(e instanceof Wt)return void e.focus();e=e.traverseNextNode(this.contentElement)}}}hasFocus(){return this.element.hasFocus()}calculateConstraints(){return new je}constraints(){return void 0!==this.constraintsInternal?this.constraintsInternal:(void 0===this.cachedConstraints&&(this.cachedConstraints=this.calculateConstraints()),this.cachedConstraints)}setMinimumAndPreferredSizes(e,t,i,n){this.constraintsInternal=new je(new Ke(e,t),new Ke(i,n)),this.invalidateConstraints()}setMinimumSize(e,t){this.constraintsInternal=new je(new Ke(e,t)),this.invalidateConstraints()}hasNonZeroConstraints(){const e=this.constraints();return Boolean(e.minimum.width||e.minimum.height||e.preferred.width||e.preferred.height)}suspendInvalidations(){++this.invalidationsSuspended}resumeInvalidations(){--this.invalidationsSuspended,!this.invalidationsSuspended&&this.invalidationsRequested&&this.invalidateConstraints()}invalidateConstraints(){if(this.invalidationsSuspended)return void(this.invalidationsRequested=!0);this.invalidationsRequested=!1;const e=this.cachedConstraints;delete this.cachedConstraints;!this.constraints().isEqual(e||null)&&this.parentWidgetInternal?this.parentWidgetInternal.invalidateConstraints():this.doLayout()}markAsExternallyManaged(){zt.assert(!this.parentWidgetInternal,"Attempt to mark widget as externally managed after insertion to the DOM"),this.externallyManaged=!0}}const Nt=new WeakMap;class _t extends zt{constructor(e,t){super(e,t),this.contentElement.classList.add("vbox")}calculateConstraints(){let e=new je;return this.callOnVisibleChildren((function(){const t=this.constraints();e=e.widthToMax(t),e=e.addHeight(t)})),e}}class Vt extends zt{constructor(e){super(e),this.contentElement.classList.add("hbox")}calculateConstraints(){let e=new je;return this.callOnVisibleChildren((function(){const t=this.constraints();e=e.addWidth(t),e=e.heightToMax(t)})),e}}class Ut{widget;previous;constructor(e){this.widget=e,this.previous=n.DOMUtilities.deepActiveElement(e.element.ownerDocument),e.focus()}restore(){this.widget&&(this.widget.hasFocus()&&this.previous&&this.previous.focus(),this.previous=null,this.widget=null)}}function Kt(e){return e.parentElementOrShadowHost()}var jt=Object.freeze({__proto__:null,WidgetElement:Ht,Widget:zt,VBox:_t,HBox:Vt,VBoxWithResizeCallback:class extends _t{resizeCallback;constructor(e){super(),this.resizeCallback=e}onResize(){this.resizeCallback()}},WidgetFocusRestorer:Ut});let qt;class Gt extends e.ObjectWrapper.ObjectWrapper{frontendHost;zoomFactorInternal;constructor(e,t){super(),this.frontendHost=t,this.zoomFactorInternal=this.frontendHost.zoomFactor(),e.addEventListener("resize",this.onWindowResize.bind(this),!0)}static instance(e={forceNew:null,win:null,frontendHost:null}){const{forceNew:t,win:i,frontendHost:n}=e;if(!qt||t){if(!i||!n)throw new Error(`Unable to create zoom manager: window and frontendHost must be provided: ${(new Error).stack}`);qt=new Gt(i,n)}return qt}static removeInstance(){qt=void 0}zoomFactor(){return this.zoomFactorInternal}cssToDIP(e){return e*this.zoomFactorInternal}dipToCSS(e){return e/this.zoomFactorInternal}onWindowResize(){const e=this.zoomFactorInternal;this.zoomFactorInternal=this.frontendHost.zoomFactor(),e!==this.zoomFactorInternal&&this.dispatchEventToListeners("ZoomChanged",{from:e,to:this.zoomFactorInternal})}}var Xt,Yt,$t=Object.freeze({__proto__:null,ZoomManager:Gt}),Qt={cssContent:".shadow-split-widget{display:flex;overflow:hidden}.shadow-split-widget-contents{display:flex;position:relative;flex-direction:column;contain:layout size style}.shadow-split-widget-sidebar{flex:none}.shadow-split-widget-main,\n.shadow-split-widget-sidebar.maximized{flex:auto}.shadow-split-widget.hbox > .shadow-split-widget-resizer{position:absolute;top:0;bottom:0;width:6px;z-index:4000}.shadow-split-widget.vbox > .shadow-split-widget-resizer{position:absolute;left:0;right:0;height:6px;z-index:4000}.shadow-split-widget.vbox > .shadow-split-widget-sidebar.no-default-splitter{border:0!important}.shadow-split-widget.vbox > .shadow-split-widget-sidebar:not(.maximized){border:0;border-top:1px solid var(--color-details-hairline)}.shadow-split-widget.hbox > .shadow-split-widget-sidebar:not(.maximized){border:0;border-left:1px solid var(--color-details-hairline)}.shadow-split-widget.vbox > .shadow-split-widget-sidebar:first-child:not(.maximized){border:0;border-bottom:1px solid var(--color-details-hairline)}.shadow-split-widget.hbox > .shadow-split-widget-sidebar:first-child:not(.maximized){border:0;border-right:1px solid var(--color-details-hairline)}:host-context(.disable-resizer-for-elements-hack) .shadow-split-widget-resizer{pointer-events:none}"};class Zt extends(e.ObjectWrapper.eventMixin(zt)){sidebarElementInternal;mainElement;resizerElementInternal;resizerElementSize;resizerWidget;defaultSidebarWidth;defaultSidebarHeight;constraintsInDip;resizeStartSizeDIP;setting;totalSizeCSS;totalSizeOtherDimensionCSS;mainWidgetInternal;sidebarWidgetInternal;animationFrameHandle;animationCallback;showSidebarButtonTitle;hideSidebarButtonTitle;shownSidebarString;hiddenSidebarString;showHideSidebarButton;isVerticalInternal;sidebarMinimized;detaching;sidebarSizeDIP;savedSidebarSizeDIP;secondIsSidebar;shouldSaveShowMode;savedVerticalMainSize;savedHorizontalMainSize;showModeInternal;savedShowMode;constructor(t,i,n,s,o,r){super(!0),this.element.classList.add("split-widget"),this.registerRequiredCSS(Qt),this.contentElement.classList.add("shadow-split-widget"),this.sidebarElementInternal=this.contentElement.createChild("div","shadow-split-widget-contents shadow-split-widget-sidebar vbox"),this.mainElement=this.contentElement.createChild("div","shadow-split-widget-contents shadow-split-widget-main vbox"),this.mainElement.createChild("slot").name="insertion-point-main",this.sidebarElementInternal.createChild("slot").name="insertion-point-sidebar",this.resizerElementInternal=this.contentElement.createChild("div","shadow-split-widget-resizer"),this.resizerElementSize=null,this.resizerWidget=new Lt,this.resizerWidget.setEnabled(!0),this.resizerWidget.addEventListener(kt.ResizeStart,this.onResizeStart,this),this.resizerWidget.addEventListener(kt.ResizeUpdatePosition,this.onResizeUpdate,this),this.resizerWidget.addEventListener(kt.ResizeEnd,this.onResizeEnd,this),this.defaultSidebarWidth=s||200,this.defaultSidebarHeight=o||this.defaultSidebarWidth,this.constraintsInDip=Boolean(r),this.resizeStartSizeDIP=0,this.setting=n?e.Settings.Settings.instance().createSetting(n,{}):null,this.totalSizeCSS=0,this.totalSizeOtherDimensionCSS=0,this.mainWidgetInternal=null,this.sidebarWidgetInternal=null,this.animationFrameHandle=0,this.animationCallback=null,this.showSidebarButtonTitle=e.UIString.LocalizedEmptyString,this.hideSidebarButtonTitle=e.UIString.LocalizedEmptyString,this.shownSidebarString=e.UIString.LocalizedEmptyString,this.hiddenSidebarString=e.UIString.LocalizedEmptyString,this.showHideSidebarButton=null,this.isVerticalInternal=!1,this.sidebarMinimized=!1,this.detaching=!1,this.sidebarSizeDIP=-1,this.savedSidebarSizeDIP=this.sidebarSizeDIP,this.secondIsSidebar=!1,this.shouldSaveShowMode=!1,this.savedVerticalMainSize=null,this.savedHorizontalMainSize=null,this.setSecondIsSidebar(i),this.innerSetVertical(t),this.showModeInternal=Xt.Both,this.savedShowMode=this.showModeInternal,this.installResizer(this.resizerElementInternal)}isVertical(){return this.isVerticalInternal}setVertical(e){this.isVerticalInternal!==e&&(this.innerSetVertical(e),this.isShowing()&&this.updateLayout())}innerSetVertical(e){this.contentElement.classList.toggle("vbox",!e),this.contentElement.classList.toggle("hbox",e),this.isVerticalInternal=e,this.resizerElementSize=null,this.sidebarSizeDIP=-1,this.restoreSidebarSizeFromSettings(),this.shouldSaveShowMode&&this.restoreAndApplyShowModeFromSettings(),this.updateShowHideSidebarButton(),this.resizerWidget.setVertical(!e),this.invalidateConstraints()}updateLayout(e){this.totalSizeCSS=0,this.totalSizeOtherDimensionCSS=0,this.mainElement.style.removeProperty("width"),this.mainElement.style.removeProperty("height"),this.sidebarElementInternal.style.removeProperty("width"),this.sidebarElementInternal.style.removeProperty("height"),this.innerSetSidebarSizeDIP(this.preferredSidebarSizeDIP(),Boolean(e))}setMainWidget(e){this.mainWidgetInternal!==e&&(this.suspendInvalidations(),this.mainWidgetInternal&&this.mainWidgetInternal.detach(),this.mainWidgetInternal=e,e&&(e.element.slot="insertion-point-main",this.showModeInternal!==Xt.OnlyMain&&this.showModeInternal!==Xt.Both||e.show(this.element)),this.resumeInvalidations())}setSidebarWidget(e){this.sidebarWidgetInternal!==e&&(this.suspendInvalidations(),this.sidebarWidgetInternal&&this.sidebarWidgetInternal.detach(),this.sidebarWidgetInternal=e,e&&(e.element.slot="insertion-point-sidebar",this.showModeInternal!==Xt.OnlySidebar&&this.showModeInternal!==Xt.Both||e.show(this.element)),this.resumeInvalidations())}mainWidget(){return this.mainWidgetInternal}sidebarWidget(){return this.sidebarWidgetInternal}sidebarElement(){return this.sidebarElementInternal}childWasDetached(e){this.detaching||(this.mainWidgetInternal===e&&(this.mainWidgetInternal=null),this.sidebarWidgetInternal===e&&(this.sidebarWidgetInternal=null),this.invalidateConstraints())}isSidebarSecond(){return this.secondIsSidebar}enableShowModeSaving(){this.shouldSaveShowMode=!0,this.restoreAndApplyShowModeFromSettings()}showMode(){return this.showModeInternal}setSecondIsSidebar(e){e!==this.secondIsSidebar&&(this.secondIsSidebar=e,this.mainWidgetInternal&&this.mainWidgetInternal.shouldHideOnDetach()?this.sidebarWidgetInternal&&this.sidebarWidgetInternal.shouldHideOnDetach()?(console.error("Could not swap split widget side. Both children widgets contain iframes."),this.secondIsSidebar=!e):e?this.contentElement.insertBefore(this.sidebarElementInternal,this.resizerElementInternal):this.contentElement.insertBefore(this.sidebarElementInternal,this.mainElement):e?this.contentElement.insertBefore(this.mainElement,this.sidebarElementInternal):this.contentElement.insertBefore(this.mainElement,this.resizerElementInternal))}sidebarSide(){return this.showModeInternal!==Xt.Both?null:this.isVerticalInternal?this.secondIsSidebar?"right":"left":this.secondIsSidebar?"bottom":"top"}resizerElement(){return this.resizerElementInternal}hideMain(e){this.showOnly(this.sidebarWidgetInternal,this.mainWidgetInternal,this.sidebarElementInternal,this.mainElement,e),this.updateShowMode(Xt.OnlySidebar)}hideSidebar(e){this.showOnly(this.mainWidgetInternal,this.sidebarWidgetInternal,this.mainElement,this.sidebarElementInternal,e),this.updateShowMode(Xt.OnlyMain)}setSidebarMinimized(e){this.sidebarMinimized=e,this.invalidateConstraints()}isSidebarMinimized(){return this.sidebarMinimized}showOnly(e,t,i,n,s){function o(){e&&(e===this.mainWidgetInternal?this.mainWidgetInternal.show(this.element,this.sidebarWidgetInternal?this.sidebarWidgetInternal.element:null):this.sidebarWidgetInternal&&this.sidebarWidgetInternal.show(this.element)),t&&(this.detaching=!0,t.detach(),this.detaching=!1),this.resizerElementInternal.classList.add("hidden"),i.classList.remove("hidden"),i.classList.add("maximized"),n.classList.add("hidden"),n.classList.remove("maximized"),this.removeAllLayoutProperties(),this.doResize(),this.showFinishedForTest()}this.cancelAnimation(),s?this.animate(!0,o.bind(this)):o.call(this),this.sidebarSizeDIP=-1,this.setResizable(!1)}showFinishedForTest(){}removeAllLayoutProperties(){this.sidebarElementInternal.style.removeProperty("flexBasis"),this.mainElement.style.removeProperty("width"),this.mainElement.style.removeProperty("height"),this.sidebarElementInternal.style.removeProperty("width"),this.sidebarElementInternal.style.removeProperty("height"),this.resizerElementInternal.style.removeProperty("left"),this.resizerElementInternal.style.removeProperty("right"),this.resizerElementInternal.style.removeProperty("top"),this.resizerElementInternal.style.removeProperty("bottom"),this.resizerElementInternal.style.removeProperty("margin-left"),this.resizerElementInternal.style.removeProperty("margin-right"),this.resizerElementInternal.style.removeProperty("margin-top"),this.resizerElementInternal.style.removeProperty("margin-bottom")}showBoth(e){this.showModeInternal===Xt.Both&&(e=!1),this.cancelAnimation(),this.mainElement.classList.remove("maximized","hidden"),this.sidebarElementInternal.classList.remove("maximized","hidden"),this.resizerElementInternal.classList.remove("hidden"),this.setResizable(!0),this.suspendInvalidations(),this.sidebarWidgetInternal&&this.sidebarWidgetInternal.show(this.element),this.mainWidgetInternal&&this.mainWidgetInternal.show(this.element,this.sidebarWidgetInternal?this.sidebarWidgetInternal.element:null),this.resumeInvalidations(),this.setSecondIsSidebar(this.secondIsSidebar),this.sidebarSizeDIP=-1,this.updateShowMode(Xt.Both),this.updateLayout(e)}setResizable(e){this.resizerWidget.setEnabled(e)}isResizable(){return this.resizerWidget.isEnabled()}setSidebarSize(e){const t=Gt.instance().cssToDIP(e);this.savedSidebarSizeDIP=t,this.saveSetting(),this.innerSetSidebarSizeDIP(t,!1,!0)}sidebarSize(){const e=Math.max(0,this.sidebarSizeDIP);return Gt.instance().dipToCSS(e)}totalSizeDIP(){return this.totalSizeCSS||(this.totalSizeCSS=this.isVerticalInternal?this.contentElement.offsetWidth:this.contentElement.offsetHeight,this.totalSizeOtherDimensionCSS=this.isVerticalInternal?this.contentElement.offsetHeight:this.contentElement.offsetWidth),Gt.instance().cssToDIP(this.totalSizeCSS)}updateShowMode(e){this.showModeInternal=e,this.saveShowModeToSettings(),this.updateShowHideSidebarButton(),this.dispatchEventToListeners(Yt.ShowModeChanged,e),this.invalidateConstraints()}innerSetSidebarSizeDIP(e,t,i){if(this.showModeInternal!==Xt.Both||!this.isShowing())return;if(e=this.applyConstraints(e,i),this.sidebarSizeDIP===e)return;this.resizerElementSize||(this.resizerElementSize=this.isVerticalInternal?this.resizerElementInternal.offsetWidth:this.resizerElementInternal.offsetHeight),this.removeAllLayoutProperties();const n=Math.round(Gt.instance().dipToCSS(e)),s=n+"px",o=this.totalSizeCSS-n+"px";this.sidebarElementInternal.style.flexBasis=s,this.isVerticalInternal?(this.sidebarElementInternal.style.width=s,this.mainElement.style.width=o,this.sidebarElementInternal.style.height=this.totalSizeOtherDimensionCSS+"px",this.mainElement.style.height=this.totalSizeOtherDimensionCSS+"px"):(this.sidebarElementInternal.style.height=s,this.mainElement.style.height=o,this.sidebarElementInternal.style.width=this.totalSizeOtherDimensionCSS+"px",this.mainElement.style.width=this.totalSizeOtherDimensionCSS+"px"),this.isVerticalInternal?this.secondIsSidebar?(this.resizerElementInternal.style.right=s,this.resizerElementInternal.style.marginRight=-this.resizerElementSize/2+"px"):(this.resizerElementInternal.style.left=s,this.resizerElementInternal.style.marginLeft=-this.resizerElementSize/2+"px"):this.secondIsSidebar?(this.resizerElementInternal.style.bottom=s,this.resizerElementInternal.style.marginBottom=-this.resizerElementSize/2+"px"):(this.resizerElementInternal.style.top=s,this.resizerElementInternal.style.marginTop=-this.resizerElementSize/2+"px"),this.sidebarSizeDIP=e,t?this.animate(!1):(this.doResize(),this.dispatchEventToListeners(Yt.SidebarSizeChanged,this.sidebarSize()))}animate(e,t){let i;this.animationCallback=t||null,i=this.isVerticalInternal?this.secondIsSidebar?"margin-right":"margin-left":this.secondIsSidebar?"margin-bottom":"margin-top";const n=e?"0":"-"+Gt.instance().dipToCSS(this.sidebarSizeDIP)+"px",s=e?"-"+Gt.instance().dipToCSS(this.sidebarSizeDIP)+"px":"0";this.contentElement.style.setProperty(i,n),this.contentElement.style.setProperty("overflow","hidden"),e||(ei(this.mainElement.offsetWidth),ei(this.sidebarElementInternal.offsetWidth)),!e&&this.sidebarWidgetInternal&&this.sidebarWidgetInternal.doResize(),this.contentElement.style.setProperty("transition",i+" 50ms linear");const o=function(){if(this.animationFrameHandle=0,r){if(!(window.performance.now()<r+50))return this.cancelAnimation(),this.mainWidgetInternal&&this.mainWidgetInternal.doResize(),void this.dispatchEventToListeners(Yt.SidebarSizeChanged,this.sidebarSize());this.mainWidgetInternal&&this.mainWidgetInternal.doResize()}else this.contentElement.style.setProperty(i,s),r=window.performance.now();this.animationFrameHandle=this.contentElement.window().requestAnimationFrame(o)}.bind(this);let r=null;this.animationFrameHandle=this.contentElement.window().requestAnimationFrame(o)}cancelAnimation(){this.contentElement.style.removeProperty("margin-top"),this.contentElement.style.removeProperty("margin-right"),this.contentElement.style.removeProperty("margin-bottom"),this.contentElement.style.removeProperty("margin-left"),this.contentElement.style.removeProperty("transition"),this.contentElement.style.removeProperty("overflow"),this.animationFrameHandle&&(this.contentElement.window().cancelAnimationFrame(this.animationFrameHandle),this.animationFrameHandle=0),this.animationCallback&&(this.animationCallback(),this.animationCallback=null)}applyConstraints(e,t){const i=this.totalSizeDIP(),s=this.constraintsInDip?1:Gt.instance().zoomFactor();let o=this.sidebarWidgetInternal?this.sidebarWidgetInternal.constraints():new je,r=this.isVertical()?o.minimum.width:o.minimum.height;r||(r=Jt),r*=s,this.sidebarMinimized&&(e=r);let a=this.isVertical()?o.preferred.width:o.preferred.height;a||(a=Jt),a*=s,e<a&&(a=Math.max(e,r)),a+=s,o=this.mainWidgetInternal?this.mainWidgetInternal.constraints():new je;let l=this.isVertical()?o.minimum.width:o.minimum.height;l||(l=Jt),l*=s;let h=this.isVertical()?o.preferred.width:o.preferred.height;h||(h=Jt),h*=s;const d=this.isVertical()?this.savedVerticalMainSize:this.savedHorizontalMainSize;null!==d&&(h=Math.min(h,d*s)),t&&(h=l);const c=h+a;if(c<=i)return n.NumberUtilities.clamp(e,a,i-h);if(l+r<=i){return e=a-(c-i)*a/c,n.NumberUtilities.clamp(e,r,i-l)}return Math.max(0,i-l)}wasShown(){this.forceUpdateLayout(),Gt.instance().addEventListener("ZoomChanged",this.onZoomChanged,this)}willHide(){Gt.instance().removeEventListener("ZoomChanged",this.onZoomChanged,this)}onResize(){this.updateLayout()}onLayout(){this.updateLayout()}calculateConstraints(){if(this.showModeInternal===Xt.OnlyMain)return this.mainWidgetInternal?this.mainWidgetInternal.constraints():new je;if(this.showModeInternal===Xt.OnlySidebar)return this.sidebarWidgetInternal?this.sidebarWidgetInternal.constraints():new je;let e=this.mainWidgetInternal?this.mainWidgetInternal.constraints():new je,t=this.sidebarWidgetInternal?this.sidebarWidgetInternal.constraints():new je;const i=Jt;return this.isVerticalInternal?(e=e.widthToMax(i).addWidth(1),t=t.widthToMax(i),e.addWidth(t).heightToMax(t)):(e=e.heightToMax(i).addHeight(1),t=t.heightToMax(i),e.widthToMax(t).addHeight(t))}onResizeStart(){this.resizeStartSizeDIP=this.sidebarSizeDIP}onResizeUpdate(e){const t=e.data.currentPosition-e.data.startPosition,i=Gt.instance().cssToDIP(t),n=this.secondIsSidebar?this.resizeStartSizeDIP-i:this.resizeStartSizeDIP+i,s=this.applyConstraints(n,!0);this.savedSidebarSizeDIP=s,this.saveSetting(),this.innerSetSidebarSizeDIP(s,!1,!0),this.isVertical()?this.savedVerticalMainSize=this.totalSizeDIP()-this.sidebarSizeDIP:this.savedHorizontalMainSize=this.totalSizeDIP()-this.sidebarSizeDIP}onResizeEnd(){this.resizeStartSizeDIP=0}hideDefaultResizer(e){this.resizerElementInternal.classList.toggle("hidden",Boolean(e)),this.uninstallResizer(this.resizerElementInternal),this.sidebarElementInternal.classList.toggle("no-default-splitter",Boolean(e))}installResizer(e){this.resizerWidget.addElement(e)}uninstallResizer(e){this.resizerWidget.removeElement(e)}hasCustomResizer(){const e=this.resizerWidget.elements();return e.length>1||1===e.length&&e[0]!==this.resizerElementInternal}toggleResizer(e,t){t?this.installResizer(e):this.uninstallResizer(e)}settingForOrientation(){const e=this.setting?this.setting.get():{};return this.isVerticalInternal?e.vertical:e.horizontal}preferredSidebarSizeDIP(){let e=this.savedSidebarSizeDIP;return e||(e=this.isVerticalInternal?this.defaultSidebarWidth:this.defaultSidebarHeight,0<e&&e<1&&(e*=this.totalSizeDIP())),e}restoreSidebarSizeFromSettings(){const e=this.settingForOrientation();this.savedSidebarSizeDIP=e?e.size:0}restoreAndApplyShowModeFromSettings(){const e=this.settingForOrientation();switch(this.savedShowMode=e&&e.showMode?e.showMode:this.showModeInternal,this.showModeInternal=this.savedShowMode,this.savedShowMode){case Xt.Both:this.showBoth();break;case Xt.OnlyMain:this.hideSidebar();break;case Xt.OnlySidebar:this.hideMain()}}saveShowModeToSettings(){this.savedShowMode=this.showModeInternal,this.saveSetting()}saveSetting(){if(!this.setting)return;const e=this.setting.get(),t=(this.isVerticalInternal?e.vertical:e.horizontal)||{};t.size=this.savedSidebarSizeDIP,this.shouldSaveShowMode&&(t.showMode=this.savedShowMode),this.isVerticalInternal?e.vertical=t:e.horizontal=t,this.setting.set(e)}forceUpdateLayout(){this.sidebarSizeDIP=-1,this.updateLayout()}onZoomChanged(){this.forceUpdateLayout()}createShowHideSidebarButton(e,t,i,n){return this.showSidebarButtonTitle=e,this.hideSidebarButtonTitle=t,this.shownSidebarString=i,this.hiddenSidebarString=n,this.showHideSidebarButton=new Pn("",""),this.showHideSidebarButton.addEventListener(Pn.Events.Click,(function(){this.toggleSidebar()}),this),this.updateShowHideSidebarButton(),this.showHideSidebarButton}toggleSidebar(){this.showModeInternal!==Xt.Both?(this.showBoth(!0),ke(this.shownSidebarString)):(this.hideSidebar(!0),ke(this.hiddenSidebarString))}updateShowHideSidebarButton(){if(!this.showHideSidebarButton)return;const e=this.showModeInternal===Xt.OnlyMain;let t="";t=e?this.isVertical()?this.isSidebarSecond()?"right-panel-open":"left-panel-open":this.isSidebarSecond()?"bottom-panel-open":"top-panel-open":this.isVertical()?this.isSidebarSecond()?"right-panel-close":"left-panel-close":this.isSidebarSecond()?"bottom-panel-close":"top-panel-close",this.showHideSidebarButton.setGlyph(t),this.showHideSidebarButton.setTitle(e?this.showSidebarButtonTitle:this.hideSidebarButtonTitle)}}!function(e){e.Both="Both",e.OnlyMain="OnlyMain",e.OnlySidebar="OnlySidebar"}(Xt||(Xt={})),function(e){e.SidebarSizeChanged="SidebarSizeChanged",e.ShowModeChanged="ShowModeChanged"}(Yt||(Yt={}));const Jt=20,ei=function(e){};var ti=Object.freeze({__proto__:null,SplitWidget:Zt,get ShowMode(){return Xt},get Events(){return Yt}});class ii{static install(e,t){e.title=t||""}static installWithActionBinding(e,t,i){let n=t;const s=eo.instance().shortcutsForAction(i);for(const e of s)n+=` - ${e.title()}`;e.title=n}}var ni=Object.freeze({__proto__:null,Tooltip:ii}),si={cssContent:".tabbed-pane{flex:auto;overflow:hidden}.tabbed-pane-content{position:relative;overflow:auto;flex:auto;display:flex;flex-direction:column}.tabbed-pane-content.has-no-tabs{background-color:var(--color-background-elevation-2)}.tabbed-pane-placeholder{font-size:14px;text-align:center;width:fit-content;margin:20px auto 0;text-shadow:var(--color-background-opacity-80) 0 1px 0;line-height:28px}.tabbed-pane-placeholder-row{display:flex;white-space:nowrap;padding:0 5px;margin:2px}.tabbed-pane-placeholder-row:focus-visible{outline-width:unset}.tabbed-pane-placeholder-key{flex:1;text-align:right;padding-right:14px;overflow:hidden;text-overflow:ellipsis}.tabbed-pane-no-shortcut{flex:1;text-align:center}.tabbed-pane-placeholder-value{flex:1;text-align:left;padding-left:14px}.tabbed-pane-header{display:flex;flex:0 0 27px;border-bottom:1px solid var(--color-details-hairline);overflow:visible;width:100%;background-color:var(--color-background-elevation-1)}.tabbed-pane-header-contents{flex:auto;pointer-events:none;margin-left:0;position:relative;cursor:default}.tabbed-pane-header-contents > *{pointer-events:initial}.tabbed-pane-header-tab-icon{min-width:14px;display:flex;align-items:center;margin-right:2px}.tabbed-pane-header-tab-icon devtools-icon{margin-left:-1px}.tabbed-pane-header-tab{float:left;padding:2px 0.8em;height:26px;line-height:16px;white-space:nowrap;cursor:default;display:flex;align-items:center;color:var(--color-text-secondary)}.tabbed-pane-header-tab.closeable{padding-right:4px}.tabbed-pane-header-tab.preview.closeable{padding-right:5px}.tabbed-pane-header-tab devtools-icon.dot::before{outline-color:var(--icon-gap-toolbar)}.tabbed-pane-header-tab:hover devtools-icon.dot::before{outline-color:var(--icon-gap-toolbar-hover)}.tabbed-pane-header-tab:hover,\n.tabbed-pane-shadow .tabbed-pane-header-tab:focus-visible{color:var(--color-text-primary);background-color:var(--color-background-elevation-2)}.tabbed-pane-header-tab-title{text-overflow:ellipsis;overflow:hidden}.tabbed-pane-header-tab.measuring{visibility:hidden}.tabbed-pane-header-tab.selected{border-bottom:none;color:var(--legacy-tab-selected-fg-color)}.-theme-with-dark-background .tabbed-pane-header-tab.selected,\n:host-context(.-theme-with-dark-background) .tabbed-pane-header-tab.selected{--override-tabbed-dark-mode-bg-color:rgb(0 0 0);background-color:var(--override-tabbed-dark-mode-bg-color)}.-theme-with-dark-background .tabbed-pane-header-tab.selected,\n:host-context(.-theme-with-dark-background) .tabbed-pane-header-tab.selected:focus-visible{background-color:var(--color-background-elevation-0)}.tabbed-pane-header-tab.dragging{--override-dragging-box-shadow-color:rgb(0 0 0/37%);position:relative;box-shadow:0 1px 4px 0 var(--override-dragging-box-shadow-color);background-color:var(--color-background-elevation-2)}.-theme-with-dark-background .tabbed-pane-header-tab.dragging,\n:host-context(.-theme-with-dark-background) .tabbed-pane-header-tab.dragging{--override-dragging-box-shadow-color:rgb(230 230 230/37%)}.tabbed-pane-header-tab .tabbed-pane-close-button{margin:0 -3px 0 4px;visibility:hidden}.tabbed-pane-header-tab:hover .tabbed-pane-close-button,\n.tabbed-pane-header-tab.selected .tabbed-pane-close-button{visibility:visible}.tabbed-pane-header-tabs-drop-down-container{float:left;opacity:80%;display:flex;align-items:center;height:100%}.tabbed-pane-header-tabs-drop-down-container > .chevron-icon{background-color:var(--icon-default);display:block}.tabbed-pane-header-tabs-drop-down-container > .chevron-icon:hover,\n.tabbed-pane-header-tabs-drop-down-container > .chevron-icon:focus-visible{background-color:var(--icon-default-hover);display:block}.tabbed-pane-header-tabs-drop-down-container:hover,\n.tabbed-pane-header-tabs-drop-down-container:focus-visible{background-color:var(--color-background-elevation-2)}.tabbed-pane-header-tabs-drop-down-container.measuring{visibility:hidden}.tabbed-pane-header-tabs-drop-down-container:active{opacity:80%}.tabbed-pane-shadow.vertical-tab-layout{flex-direction:row!important}.tabbed-pane-shadow.vertical-tab-layout .tabbed-pane-header{background-color:transparent;border:none transparent!important;width:auto;flex:0 0 auto;flex-direction:column;padding-top:10px;padding-right:4px;overflow:hidden}.tabbed-pane-shadow.vertical-tab-layout .tabbed-pane-content{padding:10px 10px 10px 4px;overflow-x:hidden}.tabbed-pane-shadow.vertical-tab-layout .tabbed-pane-header-contents{margin:0;flex:none}.tabbed-pane-shadow.vertical-tab-layout .tabbed-pane-header-tabs{display:flex;flex-direction:column;width:120px}.tabbed-pane-shadow.vertical-tab-layout .tabbed-pane-header-tab{border:none transparent;font-weight:normal;text-shadow:none;color:var(--color-text-secondary);height:26px;padding-left:10px;border-left:6px solid transparent;margin:0;display:flex;align-items:center}.tabbed-pane-shadow.vertical-tab-layout .tabbed-pane-header-tab.selected{--override-vertical-tab-selected-border-color:#666;color:inherit;border:none transparent;border-left:6px solid var(--override-vertical-tab-selected-border-color);background-color:var(--color-background-elevation-1)}.-theme-with-dark-background .tabbed-pane-shadow.vertical-tab-layout .tabbed-pane-header-tab.selected,\n:host-context(.-theme-with-dark-background) .tabbed-pane-shadow.vertical-tab-layout .tabbed-pane-header-tab.selected{--override-vertical-tab-selected-border-color:rgb(153 153 153)}.tabbed-pane-tab-slider{height:2px;position:absolute;bottom:-1px;background-color:var(--legacy-accent-color);left:0;transform-origin:0 100%;transition:transform 150ms cubic-bezier(0,0,0.2,1);visibility:hidden}:host-context(.-theme-with-dark-background) .tabbed-pane-tab-slider{display:none}@media (-webkit-min-device-pixel-ratio: 1.1){.tabbed-pane-tab-slider{border-top:none}}.tabbed-pane-tab-slider.enabled{visibility:visible}.tabbed-pane-header-tab.disabled{opacity:50%;pointer-events:none}.tabbed-pane-left-toolbar{margin-right:-4px;flex:none}.tabbed-pane-right-toolbar{margin-left:-4px;flex:none}.preview-icon{--override-tabbed-pane-preview-icon-color:var(--icon-default);width:16px;height:16px;display:flex;align-items:center;justify-content:center;margin-left:3px;flex-shrink:0}.close-button{--tabbed-pane-close-icon-color:var(--icon-default);width:16px;height:16px;display:flex;align-items:center;justify-content:center;border-radius:50%}.close-button:hover,\n.close-button:active{background-color:var(--color-details-hairline)}.tabbed-pane-header-tab.preview.closeable .close-button{margin-left:0}@media (forced-colors: active){.tabbed-pane-tab-slider{forced-color-adjust:none;background-color:Highlight}.tabbed-pane-header{forced-color-adjust:none;border-bottom:1px solid transparent;background-color:ButtonFace}.tabbed-pane-header-contents .tabbed-pane-header-tabs .tabbed-pane-header-tab{background:ButtonFace;color:ButtonText}.tabbed-pane-header-tabs .tabbed-pane-header-tab:hover,\n  .tabbed-pane-header-tabs .tabbed-pane-shadow .tabbed-pane-header-tab:focus-visible{background-color:Highlight;color:HighlightText}.tabbed-pane-header-tab .tabbed-pane-header-tab-title{color:inherit}.tabbed-pane-header-contents .tabbed-pane-header-tabs .tabbed-pane-header-tab.selected,\n  .tabbed-pane-header-contents .tabbed-pane-header-tabs .tabbed-pane-header-tab.selected:focus-visible{background-color:Highlight;color:HighlightText}.tabbed-pane-header-tab:hover .tabbed-pane-close-button,\n  .tabbed-pane-shadow .tabbed-pane-header-tab:focus-visible .tabbed-pane-close-button{--icon-color:HighlightText}.tabbed-pane-header-tabs-drop-down-container{opacity:100%}.tabbed-pane-header-tabs-drop-down-container:hover,\n  .tabbed-pane-header-tabs-drop-down-container:focus-visible{background-color:Highlight}.tabbed-pane-header-tabs-drop-down-container > .chevron-icon{background-color:ButtonText}.tabbed-pane-header-tabs-drop-down-container:hover > .chevron-icon,\n  .tabbed-pane-header-tabs-drop-down-container:focus-visible > .chevron-icon{background-color:HighlightText}.tabbed-pane-header-tabs .tabbed-pane-header-tab .preview-icon{--override-tabbed-pane-preview-icon-color:ButtonText}.tabbed-pane-header-tab.selected .preview-icon,\n  .tabbed-pane-header-tab:hover .preview-icon{--override-tabbed-pane-preview-icon-color:HighlightText}.close-button{--tabbed-pane-close-icon-color:ButtonText;forced-color-adjust:none}.close-button:hover,\n  .close-button:active{--tabbed-pane-close-icon-color:HighlightText;background-color:Highlight}.selected .close-button{--tabbed-pane-close-icon-color:HighlightText}}"};const oi={moreTabs:"More tabs",closeS:"Close {PH1}",close:"Close",closeOthers:"Close others",closeTabsToTheRight:"Close tabs to the right",closeAll:"Close all",previewFeature:"Preview feature"},ri=t.i18n.registerUIStrings("ui/legacy/TabbedPane.ts",oi),ai=t.i18n.getLocalizedString.bind(void 0,ri);class li extends(e.ObjectWrapper.eventMixin(_t)){headerElementInternal;headerContentsElement;tabSlider;tabsElement;contentElementInternal;tabs;tabsHistory;tabsById;currentTabLocked;autoSelectFirstItemOnShow;triggerDropDownTimeout;dropDownButton;currentDevicePixelRatio;shrinkableTabs;verticalTabLayout;closeableTabs;delegate;currentTab;sliderEnabled;placeholderElement;focusedPlaceholderElement;placeholderContainerElement;lastSelectedOverflowTab;overflowDisabled;measuredDropDownButtonWidth;leftToolbarInternal;rightToolbarInternal;allowTabReorder;automaticReorder;constructor(){super(!0),this.registerRequiredCSS(si),this.element.classList.add("tabbed-pane"),this.contentElement.classList.add("tabbed-pane-shadow"),this.contentElement.tabIndex=-1,this.setDefaultFocusedElement(this.contentElement),this.headerElementInternal=this.contentElement.createChild("div","tabbed-pane-header"),this.headerContentsElement=this.headerElementInternal.createChild("div","tabbed-pane-header-contents"),this.tabSlider=document.createElement("div"),this.tabSlider.classList.add("tabbed-pane-tab-slider"),this.tabsElement=this.headerContentsElement.createChild("div","tabbed-pane-header-tabs"),this.tabsElement.setAttribute("role","tablist"),this.tabsElement.addEventListener("keydown",this.keyDown.bind(this),!1),this.contentElementInternal=this.contentElement.createChild("div","tabbed-pane-content"),this.contentElementInternal.createChild("slot"),this.tabs=[],this.tabsHistory=[],this.tabsById=new Map,this.currentTabLocked=!1,this.autoSelectFirstItemOnShow=!0,this.triggerDropDownTimeout=null,this.dropDownButton=this.createDropDownButton(),this.currentDevicePixelRatio=window.devicePixelRatio,Gt.instance().addEventListener("ZoomChanged",this.zoomChanged,this),this.makeTabSlider()}setAccessibleName(e){be(this.tabsElement,e)}setCurrentTabLocked(e){this.currentTabLocked=e,this.headerElementInternal.classList.toggle("locked",this.currentTabLocked)}setAutoSelectFirstItemOnShow(e){this.autoSelectFirstItemOnShow=e}get visibleView(){return this.currentTab?this.currentTab.view:null}tabIds(){return this.tabs.map((e=>e.id))}tabIndex(e){return this.tabs.findIndex((t=>t.id===e))}tabViews(){return this.tabs.map((e=>e.view))}tabView(e){const t=this.tabsById.get(e);return t?t.view:null}get selectedTabId(){return this.currentTab?this.currentTab.id:null}setShrinkableTabs(e){this.shrinkableTabs=e}makeVerticalTabLayout(){this.verticalTabLayout=!0,this.setTabSlider(!1),this.contentElement.classList.add("vertical-tab-layout"),this.invalidateConstraints()}setCloseableTabs(e){this.closeableTabs=e}focus(){this.visibleView?this.visibleView.focus():this.contentElement.focus()}focusSelectedTabHeader(){const e=this.currentTab;e&&e.tabElement.focus()}headerElement(){return this.headerElementInternal}tabbedPaneContentElement(){return this.contentElementInternal}isTabCloseable(e){const t=this.tabsById.get(e);return!!t&&t.isCloseable()}setTabDelegate(e){const t=this.tabs.slice();for(let i=0;i<t.length;++i)t[i].setDelegate(e);this.delegate=e}appendTab(e,t,i,n,s,o,r,a){const l="boolean"==typeof o?o:Boolean(this.closeableTabs),h=new di(this,e,t,l,Boolean(r),i,n);h.setDelegate(this.delegate),console.assert(!this.tabsById.has(e),`Tabbed pane already contains a tab with id '${e}'`),this.tabsById.set(e,h),h.tabElement.tabIndex=-1,void 0!==a?this.tabs.splice(a,0,h):this.tabs.push(h),this.tabsHistory.push(h),this.tabsHistory[0]===h&&this.isShowing()&&this.selectTab(h.id,s),this.updateTabElements()}closeTab(e,t){this.closeTabs([e],t)}closeTabs(e,t){if(0===e.length)return;const i=this.hasFocus();for(let i=0;i<e.length;++i)this.innerCloseTab(e[i],t);this.updateTabElements(),this.tabsHistory.length&&this.selectTab(this.tabsHistory[0].id,!1),i&&this.focus()}innerCloseTab(e,t){const i=this.tabsById.get(e);if(!i)return;if(t&&!i.closeable)return;this.currentTab&&this.currentTab.id===e&&this.hideCurrentTab(),this.tabsById.delete(e),this.tabsHistory.splice(this.tabsHistory.indexOf(i),1),this.tabs.splice(this.tabs.indexOf(i),1),i.shown&&this.hideTabElement(i);const n={prevTabId:void 0,tabId:e,view:i.view,isUserGesture:t};return this.dispatchEventToListeners(hi.TabClosed,n),!0}hasTab(e){return this.tabsById.has(e)}otherTabs(e){const t=[];for(let i=0;i<this.tabs.length;++i)this.tabs[i].id!==e&&t.push(this.tabs[i].id);return t}tabsToTheRight(e){let t=-1;for(let i=0;i<this.tabs.length;++i)if(this.tabs[i].id===e){t=i;break}return-1===t?[]:this.tabs.slice(t+1).map((function(e){return e.id}))}viewHasFocus(){if(this.visibleView&&this.visibleView.hasFocus())return!0;const e=this.contentElement.getComponentRoot();return e instanceof Document&&this.contentElement===e.activeElement}selectTab(e,t,i){if(this.currentTabLocked)return!1;const n=this.viewHasFocus(),s=this.tabsById.get(e);if(!s)return!1;const o={prevTabId:this.currentTab?this.currentTab.id:void 0,tabId:e,view:s.view,isUserGesture:t};return this.dispatchEventToListeners(hi.TabInvoked,o),this.currentTab&&this.currentTab.id===e||(this.suspendInvalidations(),this.hideCurrentTab(),this.showTab(s),this.resumeInvalidations(),this.currentTab=s,this.tabsHistory.splice(this.tabsHistory.indexOf(s),1),this.tabsHistory.splice(0,0,s),this.updateTabElements(),(n||i)&&this.focus(),this.dispatchEventToListeners(hi.TabSelected,o)),!0}selectNextTab(){const e=this.tabs.indexOf(this.currentTab),t=n.NumberUtilities.mod(e+1,this.tabs.length);this.selectTab(this.tabs[t].id,!0)}selectPrevTab(){const e=this.tabs.indexOf(this.currentTab),t=n.NumberUtilities.mod(e-1,this.tabs.length);this.selectTab(this.tabs[t].id,!0)}lastOpenedTabIds(e){return this.tabsHistory.slice(0,e).map((function(e){return e.id}))}setTabIcon(e,t){const i=this.tabsById.get(e);i&&(i.setIcon(t),this.updateTabElements())}setTabEnabled(e,t){const i=this.tabsById.get(e);i&&i.tabElement.classList.toggle("disabled",!t)}toggleTabClass(e,t,i){const n=this.tabsById.get(e);n&&n.toggleClass(t,i)&&this.updateTabElements()}zoomChanged(){this.clearMeasuredWidths(),this.isShowing()&&this.updateTabElements()}clearMeasuredWidths(){for(let e=0;e<this.tabs.length;++e)delete this.tabs[e].measuredWidth}changeTabTitle(e,t,i){const n=this.tabsById.get(e);n&&void 0!==i&&(n.tooltip=i),n&&n.title!==t&&(n.title=t,be(n.tabElement,t),this.updateTabElements())}changeTabView(e,t){const i=this.tabsById.get(e);if(!i||i.view===t)return;this.suspendInvalidations();const n=this.currentTab&&this.currentTab.id===e,s=i.view.hasFocus();n&&this.hideTab(i),i.view=t,n&&this.showTab(i),s&&i.view.focus(),this.resumeInvalidations()}onResize(){this.currentDevicePixelRatio!==window.devicePixelRatio&&(this.clearMeasuredWidths(),this.currentDevicePixelRatio=window.devicePixelRatio),this.updateTabElements()}headerResized(){this.updateTabElements()}wasShown(){const e=this.currentTab||this.tabsHistory[0];e&&this.autoSelectFirstItemOnShow&&this.selectTab(e.id)}makeTabSlider(){this.verticalTabLayout||this.setTabSlider(!0)}setTabSlider(e){this.sliderEnabled=e,this.tabSlider.classList.toggle("enabled",e)}calculateConstraints(){let e=super.calculateConstraints();const t=new je(new Ke(0,0),new Ke(50,50));return e=e.widthToMax(t).heightToMax(t),e=this.verticalTabLayout?e.addWidth(new je(new Ke(120,0))):e.addHeight(new je(new Ke(0,30))),e}updateTabElements(){vs(this,this.innerUpdateTabElements)}setPlaceholderElement(e,t){this.placeholderElement=e,t&&(this.focusedPlaceholderElement=t),this.placeholderContainerElement&&(this.placeholderContainerElement.removeChildren(),this.placeholderContainerElement.appendChild(e))}async waitForTabElementUpdate(){this.innerUpdateTabElements()}innerUpdateTabElements(){this.isShowing()&&(this.tabs.length?(this.contentElementInternal.classList.remove("has-no-tabs"),this.placeholderContainerElement&&(this.placeholderContainerElement.remove(),this.setDefaultFocusedElement(this.contentElement),delete this.placeholderContainerElement)):(this.contentElementInternal.classList.add("has-no-tabs"),this.placeholderElement&&!this.placeholderContainerElement&&(this.placeholderContainerElement=this.contentElementInternal.createChild("div","tabbed-pane-placeholder fill"),this.placeholderContainerElement.appendChild(this.placeholderElement),this.focusedPlaceholderElement&&this.setDefaultFocusedElement(this.focusedPlaceholderElement))),this.measureDropDownButton(),this.adjustToolbarWidth(),this.updateWidths(),this.updateTabsDropDown(),this.updateTabSlider())}adjustToolbarWidth(){if(!this.rightToolbarInternal||!this.measuredDropDownButtonWidth)return;const e=this.leftToolbarInternal?.element.getBoundingClientRect().width??0,t=this.rightToolbarInternal.element.getBoundingClientRect().width,i=this.headerElementInternal.getBoundingClientRect().width;!this.rightToolbarInternal.hasCompactLayout()&&i-t-e<this.measuredDropDownButtonWidth+10?this.rightToolbarInternal.setCompactLayout(!0):this.rightToolbarInternal.hasCompactLayout()&&i-2*t-e>this.measuredDropDownButtonWidth+10&&this.rightToolbarInternal.setCompactLayout(!1)}showTabElement(e,t){e>=this.tabsElement.children.length?this.tabsElement.appendChild(t.tabElement):this.tabsElement.insertBefore(t.tabElement,this.tabsElement.children[e]),t.shown=!0}hideTabElement(e){this.tabsElement.removeChild(e.tabElement),e.shown=!1}createDropDownButton(){const e=document.createElement("div");e.classList.add("tabbed-pane-header-tabs-drop-down-container");const t=Pe.create("chevron-double-right","chevron-icon"),i=ai(oi.moreTabs);return e.title=i,z(e),be(e,i),e.tabIndex=0,e.appendChild(t),e.addEventListener("click",this.dropDownClicked.bind(this)),e.addEventListener("keydown",this.dropDownKeydown.bind(this)),e.addEventListener("mousedown",(e=>{0!==e.button||this.triggerDropDownTimeout||(this.triggerDropDownTimeout=window.setTimeout(this.dropDownClicked.bind(this,e),200))})),e}dropDownClicked(e){const t=e;if(0!==t.button)return;this.triggerDropDownTimeout&&(clearTimeout(this.triggerDropDownTimeout),this.triggerDropDownTimeout=null);const i=this.dropDownButton.getBoundingClientRect(),n=new fo(t,{useSoftMenu:!1,x:i.left,y:i.bottom});for(const e of this.tabs)e.shown||(0===this.numberOfTabsShown()&&this.tabsHistory[0]===e?n.defaultSection().appendCheckboxItem(e.title,this.dropDownMenuItemSelected.bind(this,e),!0):n.defaultSection().appendItem(e.title,this.dropDownMenuItemSelected.bind(this,e)));n.show()}dropDownKeydown(e){n.KeyboardUtilities.isEnterOrSpaceKey(e)&&(this.dropDownButton.click(),e.consume(!0))}dropDownMenuItemSelected(e){this.lastSelectedOverflowTab=e,this.selectTab(e.id,!0,!0)}totalWidth(){return this.headerContentsElement.getBoundingClientRect().width}numberOfTabsShown(){let e=0;for(const t of this.tabs)t.shown&&e++;return e}disableOverflowMenu(){this.overflowDisabled=!0}updateTabsDropDown(){const e=this.tabsToShowIndexes(this.tabs,this.tabsHistory,this.totalWidth(),this.measuredDropDownButtonWidth||0);if(this.lastSelectedOverflowTab&&this.numberOfTabsShown()!==e.length)return delete this.lastSelectedOverflowTab,void this.updateTabsDropDown();for(let t=0;t<this.tabs.length;++t)this.tabs[t].shown&&-1===e.indexOf(t)&&this.hideTabElement(this.tabs[t]);for(let t=0;t<e.length;++t){const i=this.tabs[e[t]];i.shown||this.showTabElement(t,i)}this.overflowDisabled||this.maybeShowDropDown(e.length!==this.tabs.length)}maybeShowDropDown(e){e&&!this.dropDownButton.parentElement?this.headerContentsElement.appendChild(this.dropDownButton):!e&&this.dropDownButton.parentElement&&this.headerContentsElement.removeChild(this.dropDownButton)}measureDropDownButton(){this.overflowDisabled||this.measuredDropDownButtonWidth||(this.dropDownButton.classList.add("measuring"),this.headerContentsElement.appendChild(this.dropDownButton),this.measuredDropDownButtonWidth=this.dropDownButton.getBoundingClientRect().width,this.headerContentsElement.removeChild(this.dropDownButton),this.dropDownButton.classList.remove("measuring"))}updateWidths(){const e=this.measureWidths(),t=this.shrinkableTabs?this.calculateMaxWidth(e.slice(),this.totalWidth()):Number.MAX_VALUE;let i=0;for(const n of this.tabs)n.setWidth(this.verticalTabLayout?-1:Math.min(t,e[i++]))}measureWidths(){this.tabsElement.style.setProperty("width","2000px");const e=new Map;for(const t of this.tabs){if("number"==typeof t.measuredWidth)continue;const i=t.createTabElement(!0);e.set(i,t),this.tabsElement.appendChild(i)}for(const[t,i]of e){const e=t.getBoundingClientRect().width;i.measuredWidth=Math.ceil(e)}for(const t of e.keys())t.remove();const t=[];for(const e of this.tabs)t.push(e.measuredWidth||0);return this.tabsElement.style.removeProperty("width"),t}calculateMaxWidth(e,t){if(!e.length)return 0;e.sort((function(e,t){return e-t}));let i=0;for(let t=0;t<e.length;++t)i+=e[t];if(t>=i)return e[e.length-1];let n=0;for(let s=e.length-1;s>0;--s){const o=e[s]-e[s-1];if(n+=(e.length-s)*o,t+n>=i)return e[s-1]+(t+n-i)/(e.length-s)}return t/e.length}tabsToShowIndexes(e,t,i,n){const s=[];let o=0;const r=e.length,a=e.slice(0);void 0!==this.currentTab&&a.unshift(a.splice(a.indexOf(this.currentTab),1)[0]),void 0!==this.lastSelectedOverflowTab&&a.unshift(a.splice(a.indexOf(this.lastSelectedOverflowTab),1)[0]);for(let l=0;l<r;++l){const h=this.automaticReorder?t[l]:a[l];o+=h.width();let d=o;if(l!==r-1&&(d+=n),!this.verticalTabLayout&&d>i)break;s.push(e.indexOf(h))}return s.sort((function(e,t){return e-t})),s}hideCurrentTab(){this.currentTab&&(this.hideTab(this.currentTab),delete this.currentTab)}showTab(e){e.tabElement.tabIndex=0,e.tabElement.classList.add("selected"),ue(e.tabElement,!0),e.view.show(this.element),this.updateTabSlider()}updateTabSlider(){if(!this.sliderEnabled)return;if(!this.currentTab)return void(this.tabSlider.style.width="0");let e=0;for(let t=0;t<this.tabs.length&&this.currentTab!==this.tabs[t];t++)this.tabs[t].shown&&(e+=this.tabs[t].measuredWidth||0);const t=this.currentTab.shown?this.currentTab.measuredWidth:this.dropDownButton.offsetWidth,i=window.devicePixelRatio>=1.5?" scaleY(0.75)":"";this.tabSlider.style.transform="translateX("+e+"px)"+i,this.tabSlider.style.width=t+"px",this.tabSlider.parentElement!==this.headerContentsElement&&this.headerContentsElement.appendChild(this.tabSlider)}hideTab(e){e.tabElement.removeAttribute("tabIndex"),e.tabElement.classList.remove("selected"),e.tabElement.tabIndex=-1,e.tabElement.setAttribute("aria-selected","false"),e.view.detach()}elementsToRestoreScrollPositionsFor(){return[this.contentElementInternal]}insertBefore(e,t){this.tabsElement.insertBefore(e.tabElement,this.tabsElement.childNodes[t]);const i=this.tabs.indexOf(e);this.tabs.splice(i,1),i<t&&--t,this.tabs.splice(t,0,e);const n={prevTabId:void 0,tabId:e.id,view:e.view,isUserGesture:void 0};this.dispatchEventToListeners(hi.TabOrderChanged,n)}leftToolbar(){return this.leftToolbarInternal||(this.leftToolbarInternal=new kn("tabbed-pane-left-toolbar"),this.headerElementInternal.insertBefore(this.leftToolbarInternal.element,this.headerElementInternal.firstChild)),this.leftToolbarInternal}rightToolbar(){return this.rightToolbarInternal||(this.rightToolbarInternal=new kn("tabbed-pane-right-toolbar"),this.headerElementInternal.appendChild(this.rightToolbarInternal.element)),this.rightToolbarInternal}setAllowTabReorder(e,t){this.allowTabReorder=e,this.automaticReorder=t}keyDown(e){if(!this.currentTab)return;let t=null;switch(e.key){case"ArrowUp":case"ArrowLeft":t=this.currentTab.tabElement.previousElementSibling,t||this.dropDownButton.parentElement||(t=this.currentTab.tabElement.parentElement?this.currentTab.tabElement.parentElement.lastElementChild:null);break;case"ArrowDown":case"ArrowRight":t=this.currentTab.tabElement.nextElementSibling,t||this.dropDownButton.parentElement||(t=this.currentTab.tabElement.parentElement?this.currentTab.tabElement.parentElement.firstElementChild:null);break;case"Enter":case" ":return void this.currentTab.view.focus();default:return}if(!t)return void this.dropDownButton.click();const i=this.tabs.find((e=>e.tabElement===t));i&&this.selectTab(i.id,!0),t.focus()}}var hi;!function(e){e.TabInvoked="TabInvoked",e.TabSelected="TabSelected",e.TabClosed="TabClosed",e.TabOrderChanged="TabOrderChanged"}(hi||(hi={}));class di{closeable;previewFeature=!1;tabbedPane;idInternal;titleInternal;tooltipInternal;viewInternal;shown;measuredWidth;tabElementInternal;iconContainer;icon;widthInternal;delegate;titleElement;dragStartX;constructor(e,t,i,n,s,o,r){this.closeable=n,this.previewFeature=s,this.tabbedPane=e,this.idInternal=t,this.titleInternal=i,this.tooltipInternal=r,this.viewInternal=o,this.shown=!1,this.iconContainer=null}get id(){return this.idInternal}get title(){return this.titleInternal}set title(e){if(e!==this.titleInternal){if(this.titleInternal=e,this.titleElement){this.titleElement.textContent=e;const t=this.tabElementInternal?.querySelector(".close-button");t?.setAttribute("title",ai(oi.closeS,{PH1:e})),t?.setAttribute("aria-label",ai(oi.closeS,{PH1:e}))}delete this.measuredWidth}}isCloseable(){return this.closeable}setIcon(e){this.icon=e,this.tabElementInternal&&this.titleElement&&this.createIconElement(this.tabElementInternal,this.titleElement,!1),delete this.measuredWidth}toggleClass(e,t){const i=this.tabElement;return i.classList.contains(e)!==t&&(i.classList.toggle(e,t),delete this.measuredWidth,!0)}get view(){return this.viewInternal}set view(e){this.viewInternal=e}get tooltip(){return this.tooltipInternal}set tooltip(e){this.tooltipInternal=e,this.titleElement&&ii.install(this.titleElement,e||"")}get tabElement(){return this.tabElementInternal||(this.tabElementInternal=this.createTabElement(!1)),this.tabElementInternal}width(){return this.widthInternal||0}setWidth(e){this.tabElement.style.width=-1===e?"":e+"px",this.widthInternal=e}setDelegate(e){this.delegate=e}createIconElement(e,t,i){const n=ci.get(e);if(n&&(n.remove(),ci.delete(e)),!this.icon)return;const s=document.createElement("span");s.classList.add("tabbed-pane-header-tab-icon");const o=i?this.icon.cloneNode(!0):this.icon;s.appendChild(o),e.insertBefore(s,t),ci.set(e,s)}createTabElement(e){const t=document.createElement("div");t.classList.add("tabbed-pane-header-tab"),t.id="tab-"+this.idInternal,N(t),ue(t,!1),be(t,this.title);const i=t.createChild("span","tabbed-pane-header-tab-title");if(i.textContent=this.title,ii.install(i,this.tooltip||""),this.createIconElement(t,i,e),e||(this.titleElement=i),this.previewFeature){const e=this.createPreviewIcon();t.appendChild(e),t.classList.add("preview")}if(this.closeable){const e=this.createCloseIconButton();t.appendChild(e),t.classList.add("closeable")}return e?t.classList.add("measuring"):(t.addEventListener("click",this.tabClicked.bind(this),!1),t.addEventListener("auxclick",this.tabClicked.bind(this),!1),t.addEventListener("mousedown",this.tabMouseDown.bind(this),!1),t.addEventListener("mouseup",this.tabMouseUp.bind(this),!1),t.addEventListener("contextmenu",this.tabContextMenu.bind(this),!1),this.tabbedPane.allowTabReorder&&Qn(t,this.startTabDragging.bind(this),this.tabDragging.bind(this),this.endTabDragging.bind(this),null,null,200)),t}createCloseIconButton(){const e=document.createElement("div");e.classList.add("close-button","tabbed-pane-close-button");const t=new a.Icon.Icon;return t.data={iconName:"cross",color:"var(--tabbed-pane-close-icon-color)",width:"16px"},e.appendChild(t),e.setAttribute("role","button"),e.setAttribute("title",ai(oi.closeS,{PH1:this.title})),e.setAttribute("aria-label",ai(oi.closeS,{PH1:this.title})),e}createPreviewIcon(){const e=document.createElement("div");e.classList.add("preview-icon");const t=new a.Icon.Icon;return t.data={iconName:"experiment",color:"var(--override-tabbed-pane-preview-icon-color)",width:"16px"},e.appendChild(t),e.setAttribute("title",ai(oi.previewFeature)),e.setAttribute("aria-label",ai(oi.previewFeature)),e}isCloseIconClicked(e){return e?.classList.contains("tabbed-pane-close-button")||e?.parentElement?.classList.contains("tabbed-pane-close-button")||!1}tabClicked(e){const t=e,i=1===t.button;this.closeable&&(i||this.isCloseIconClicked(t.target))?(this.closeTabs([this.id]),t.consume(!0)):this.tabbedPane.focus()}tabMouseDown(e){const t=e;this.isCloseIconClicked(t.target)||0!==t.button||this.tabbedPane.selectTab(this.id,!0)}tabMouseUp(e){const t=e;1===t.button&&t.consume(!0)}closeTabs(e){this.delegate?this.delegate.closeTabs(this.tabbedPane,e):this.tabbedPane.closeTabs(e,!0)}tabContextMenu(e){const t=new fo(e);this.closeable&&(t.defaultSection().appendItem(ai(oi.close),function(){this.closeTabs([this.id])}.bind(this)),t.defaultSection().appendItem(ai(oi.closeOthers),function(){this.closeTabs(this.tabbedPane.otherTabs(this.id))}.bind(this)),t.defaultSection().appendItem(ai(oi.closeTabsToTheRight),function(){this.closeTabs(this.tabbedPane.tabsToTheRight(this.id))}.bind(this)),t.defaultSection().appendItem(ai(oi.closeAll),function(){this.closeTabs(this.tabbedPane.tabIds())}.bind(this))),this.delegate&&this.delegate.onContextMenu(this.id,t),t.show()}startTabDragging(e){const t=e;return!this.isCloseIconClicked(t.target)&&(this.dragStartX=t.pageX,this.tabElementInternal&&this.tabElementInternal.classList.add("dragging"),this.tabbedPane.tabSlider.remove(),!0)}tabDragging(e){const t=e,i=this.tabbedPane.tabsElement.childNodes;for(let e=0;e<i.length;++e){let n=i[e];if(!this.tabElementInternal||n===this.tabElementInternal)continue;if(!(n.offsetLeft+n.clientWidth>this.tabElementInternal.offsetLeft&&this.tabElementInternal.offsetLeft+this.tabElementInternal.clientWidth>n.offsetLeft))continue;const s=this.dragStartX;if(Math.abs(t.pageX-s)<n.clientWidth/2+5)break;t.pageX-s>0&&(n=n.nextSibling,++e);const o=this.tabElementInternal.offsetLeft;this.tabbedPane.insertBefore(this,e),this.dragStartX=s+this.tabElementInternal.offsetLeft-o;break}const n=this.dragStartX,s=this.tabElementInternal;!s.previousSibling&&t.pageX-n<0||!s.nextSibling&&t.pageX-n>0?s.style.setProperty("left","0px"):s.style.setProperty("left",t.pageX-n+"px")}endTabDragging(e){const t=this.tabElementInternal;t.classList.remove("dragging"),t.style.removeProperty("left"),delete this.dragStartX,this.tabbedPane.updateTabSlider()}}const ci=new WeakMap;var ui=Object.freeze({__proto__:null,TabbedPane:li,get Events(){return hi},TabbedPaneTab:di});const mi={elements:"Elements",drawer:"Drawer",drawer_sidebar:"Drawer sidebar",panel:"Panel",network:"Network",settings:"Settings",sources:"Sources"},pi=t.i18n.registerUIStrings("ui/legacy/ViewRegistration.ts",mi),gi=t.i18n.getLocalizedString.bind(void 0,pi),bi=[],fi=new Set;function vi(){return bi.filter((e=>i.Runtime.Runtime.isDescriptorEnabled({experiment:e.experiment(),condition:e.condition()})))}const wi=[],xi=new Set;function Ei(){return wi}var Ii;!function(e){e.NONE="",e.ELEMENTS="ELEMENTS",e.DRAWER="DRAWER",e.DRAWER_SIDEBAR="DRAWER_SIDEBAR",e.PANEL="PANEL",e.NETWORK="NETWORK",e.SETTINGS="SETTINGS",e.SOURCES="SOURCES"}(Ii||(Ii={}));var Si={cssContent:".expandable-view-title{display:flex;align-items:center;background-color:var(--color-background-elevation-1);height:22px;padding:0 5px;border-top:1px solid var(--color-details-hairline);white-space:nowrap;overflow:hidden;position:relative;border-bottom:1px solid transparent}.expandable-view-title.expanded,\n.expandable-view-title:last-child{border-bottom:1px solid var(--color-details-hairline)}.expandable-view-title .toolbar{margin-top:-3px}.expandable-view-title > .toolbar{position:absolute;right:0;top:0}.expandable-view-title:not(.expanded) .toolbar{display:none}.title-expand-icon{margin-right:2px;margin-bottom:-2px}.expandable-view-title:focus-visible{background-color:var(--legacy-focus-bg-color)}@media (forced-colors: active){.expandable-view-title:focus-visible{forced-color-adjust:none;color:HighlightText;background-color:Highlight;box-shadow:0 0 0 2px Highlight inset}.expandable-view-title:focus-visible .title-expand-icon{background-color:HighlightText}}"};const yi={sPanel:"{PH1} panel"},Ci=t.i18n.registerUIStrings("ui/legacy/ViewManager.ts",yi),ki=t.i18n.getLocalizedString.bind(void 0,Ci),Ti={security:!0};class Mi{viewRegistration;widgetRequested;constructor(e){this.viewRegistration=e,this.widgetRequested=!1}title(){return this.viewRegistration.title()}commandPrompt(){return this.viewRegistration.commandPrompt()}isCloseable(){return"closeable"===this.viewRegistration.persistence}isPreviewFeature(){return Boolean(this.viewRegistration.isPreviewFeature)}isTransient(){return"transient"===this.viewRegistration.persistence}viewId(){return this.viewRegistration.id}location(){return this.viewRegistration.location}order(){return this.viewRegistration.order}settings(){return this.viewRegistration.settings}tags(){if(this.viewRegistration.tags)return this.viewRegistration.tags.map((e=>e())).join("\0")}persistence(){return this.viewRegistration.persistence}async toolbarItems(){return this.viewRegistration.hasToolbar?this.widget().then((e=>e.toolbarItems())):[]}async widget(){return this.widgetRequested=!0,this.viewRegistration.loadView()}async disposeView(){if(!this.widgetRequested)return;const e=await this.widget();await e.ownerViewDisposed()}experiment(){return this.viewRegistration.experiment}condition(){return this.viewRegistration.condition}}let Li;class Pi{views;locationNameByViewId;locationOverrideSetting;constructor(){this.views=new Map,this.locationNameByViewId=new Map,this.locationOverrideSetting=e.Settings.Settings.instance().createSetting("viewsLocationOverride",{});const t=this.locationOverrideSetting.get(),i=new Map;for(const e of vi()){const t=e.location()||"none",n=i.get(t)||[];n.push(e),i.set(t,n)}let n=[];for(const e of i.values())e.sort(((e,t)=>{const i=e.order(),n=t.order();return void 0!==i&&void 0!==n?i-n:0})),n=n.concat(e);for(const e of n){const i=e.viewId(),n=e.location();if(this.views.has(i))throw new Error(`Duplicate view id '${i}'`);this.views.set(i,e);const s=t[i]||n;this.locationNameByViewId.set(i,s)}}static instance(e={forceNew:null}){const{forceNew:t}=e;return Li&&!t||(Li=new Pi),Li}static removeInstance(){Li=void 0}static createToolbar(e){if(!e.length)return null;const t=new kn("");for(const i of e)t.appendToolbarItem(i);return t.element}locationNameForViewId(e){const t=this.locationNameByViewId.get(e);if(!t)throw new Error(`No location name for view with id ${e}`);return t}moveView(e,t,i){const{shouldSelectTab:n,overrideSaving:s}=i||{shouldSelectTab:!0,overrideSaving:!1};if(!e||!t)return;const o=this.view(e);if(o){if(!s){this.locationNameByViewId.set(e,t);const i=this.locationOverrideSetting.get();i[e]=t,this.locationOverrideSetting.set(i)}this.resolveLocation(t).then((t=>{if(!t)throw new Error("Move view: Could not resolve location for view: "+e);return t.reveal(),t.showView(o,void 0,!0,!1,n)}))}}revealView(e){const t=Wi.get(e);return t?(t.reveal(),t.showView(e)):Promise.resolve()}showViewInLocation(e,t,i=!0){this.moveView(e,t,{shouldSelectTab:i,overrideSaving:!0})}view(e){const t=this.views.get(e);if(!t)throw new Error(`No view with id ${e} found!`);return t}materializedWidget(e){const t=this.view(e);return t&&Di.get(t)||null}showView(e,t,i){const n=this.views.get(e);if(!n)return console.error("Could not find view for id: '"+e+"' "+(new Error).stack),Promise.resolve();const s=this.locationNameByViewId.get(e),o=Wi.get(n);return o?(o.reveal(),o.showView(n,void 0,t,i)):this.resolveLocation(s).then((s=>{if(!s)throw new Error("Could not resolve location for view: "+e);return s.reveal(),s.showView(n,void 0,t,i)}))}async resolveLocation(e){if(!e)return Promise.resolve(null);const t=Ei().filter((t=>t.name===e));if(t.length>1)throw new Error("Duplicate resolver for location: "+e);if(t.length){return(await t[0].loadResolver()).resolveLocation(e)}throw new Error("Unresolved location: "+e)}createTabbedLocation(e,t,i,n,s){return new Fi(this,e,t,i,n,s)}createStackLocation(e,t){return new Hi(this,e,t)}hasViewsForLocation(e){return Boolean(this.viewsForLocation(e).length)}viewsForLocation(e){const t=[];for(const[i,n]of this.views.entries())this.locationNameByViewId.get(i)===e&&t.push(n);return t}}const Di=new WeakMap;class Ri extends _t{view;materializePromise;constructor(e){super(),this.element.classList.add("flex-auto","view-container","overflow-auto"),this.view=e,this.element.tabIndex=-1,_(this.element),be(this.element,ki(yi.sPanel,{PH1:e.title()})),this.setDefaultFocusedElement(this.element)}materialize(){if(this.materializePromise)return this.materializePromise;const e=[];return e.push(this.view.toolbarItems().then((e=>{const t=Pi.createToolbar(e);t&&this.element.insertBefore(t,this.element.firstChild)}))),e.push(this.view.widget().then((e=>{const t=this.element.hasFocus();this.setDefaultFocusedElement(null),Di.set(this.view,e),e.show(this.element),t&&e.focus()}))),this.materializePromise=Promise.all(e).then((()=>{})),this.materializePromise}wasShown(){this.materialize().then((()=>{const e=Di.get(this.view);e&&(e.show(this.element),this.wasShownForTest())}))}wasShownForTest(){}}class Ai extends _t{titleElement;titleExpandIcon;view;widget;materializePromise;constructor(e){super(!0),this.element.classList.add("flex-none"),this.registerRequiredCSS(Si),this.titleElement=document.createElement("div"),this.titleElement.classList.add("expandable-view-title"),U(this.titleElement),this.titleExpandIcon=Pe.create("triangle-right","title-expand-icon"),this.titleElement.appendChild(this.titleExpandIcon);const t=e.title();Es(this.titleElement,t),be(this.titleElement,t),re(this.titleElement,!1),this.titleElement.tabIndex=0,self.onInvokeElement(this.titleElement,this.toggleExpanded.bind(this)),this.titleElement.addEventListener("keydown",this.onTitleKeyDown.bind(this),!1),this.contentElement.insertBefore(this.titleElement,this.contentElement.firstChild),oe(this.titleElement,this.contentElement.createChild("slot")),this.view=e,Oi.set(e,this)}wasShown(){this.widget&&this.materializePromise&&this.materializePromise.then((()=>{this.titleElement.classList.contains("expanded")&&this.widget&&this.widget.show(this.element)}))}materialize(){if(this.materializePromise)return this.materializePromise;const e=[];return e.push(this.view.toolbarItems().then((e=>{const t=Pi.createToolbar(e);t&&this.titleElement.appendChild(t)}))),e.push(this.view.widget().then((e=>{this.widget=e,Di.set(this.view,e),e.show(this.element)}))),this.materializePromise=Promise.all(e).then((()=>{})),this.materializePromise}expand(){return this.titleElement.classList.contains("expanded")?this.materialize():(this.titleElement.classList.add("expanded"),re(this.titleElement,!0),this.titleExpandIcon.setIconType("triangle-down"),this.materialize().then((()=>{this.widget&&this.widget.show(this.element)})))}collapse(){this.titleElement.classList.contains("expanded")&&(this.titleElement.classList.remove("expanded"),re(this.titleElement,!1),this.titleExpandIcon.setIconType("triangle-right"),this.materialize().then((()=>{this.widget&&this.widget.detach()})))}toggleExpanded(e){"keydown"===e.type&&e.target!==this.titleElement||(this.titleElement.classList.contains("expanded")?this.collapse():this.expand())}onTitleKeyDown(e){if(e.target!==this.titleElement)return;const t=e;"ArrowLeft"===t.key?this.collapse():"ArrowRight"===t.key&&(this.titleElement.classList.contains("expanded")?this.widget&&this.widget.focus():this.expand())}}const Oi=new WeakMap;class Bi{manager;revealCallback;widgetInternal;constructor(e,t,i){this.manager=e,this.revealCallback=i,this.widgetInternal=t}widget(){return this.widgetInternal}reveal(){this.revealCallback&&this.revealCallback()}showView(e,t,i,n,s){throw new Error("not implemented")}removeView(e){throw new Error("not implemented")}}const Wi=new WeakMap;class Fi extends Bi{tabbedPaneInternal;allowReorder;closeableTabSetting;tabOrderSetting;lastSelectedTabSetting;defaultTab;views;constructor(t,i,n,s,o,r){const a=new li;o&&a.setAllowTabReorder(!0),super(t,a,i),this.tabbedPaneInternal=a,this.allowReorder=o,this.tabbedPaneInternal.addEventListener(hi.TabSelected,this.tabSelected,this),this.tabbedPaneInternal.addEventListener(hi.TabClosed,this.tabClosed,this),this.closeableTabSetting=e.Settings.Settings.instance().createSetting("closeableTabs",{}),this.setOrUpdateCloseableTabsSetting(),this.tabOrderSetting=e.Settings.Settings.instance().createSetting(n+"-tabOrder",{}),this.tabbedPaneInternal.addEventListener(hi.TabOrderChanged,this.persistTabOrder,this),s&&(this.lastSelectedTabSetting=e.Settings.Settings.instance().createSetting(n+"-selectedTab","")),this.defaultTab=r,this.views=new Map,n&&this.appendApplicableItems(n)}setOrUpdateCloseableTabsSetting(){const e={...Ti,...this.closeableTabSetting.get()};this.closeableTabSetting.set(e)}widget(){return this.tabbedPaneInternal}tabbedPane(){return this.tabbedPaneInternal}enableMoreTabsButton(){const e=new An(this.appendTabsToMenu.bind(this));return this.tabbedPaneInternal.leftToolbar().appendToolbarItem(e),this.tabbedPaneInternal.disableOverflowMenu(),e}appendApplicableItems(e){const t=this.manager.viewsForLocation(e);if(this.allowReorder){let e=0;const i=this.tabOrderSetting.get(),n=new Map;for(const s of t)n.set(s.viewId(),i[s.viewId()]||++e*Fi.orderStep);t.sort(((e,t)=>n.get(e.viewId())-n.get(t.viewId())))}for(const e of t){const t=e.viewId();this.views.set(t,e),Wi.set(e,this),e.isTransient()||(e.isCloseable()?this.closeableTabSetting.get()[t]&&this.appendTab(e):this.appendTab(e))}if(this.defaultTab)if(this.tabbedPaneInternal.hasTab(this.defaultTab))this.tabbedPaneInternal.selectTab(this.defaultTab);else{const e=Array.from(this.views.values()).find((e=>e.viewId()===this.defaultTab));e&&this.showView(e)}else this.lastSelectedTabSetting&&this.tabbedPaneInternal.hasTab(this.lastSelectedTabSetting.get())&&this.tabbedPaneInternal.selectTab(this.lastSelectedTabSetting.get())}appendTabsToMenu(e){const t=Array.from(this.views.values());t.sort(((e,t)=>e.title().localeCompare(t.title())));for(const i of t){const t=i.title();"issues-pane"!==i.viewId()?e.defaultSection().appendItem(t,this.showView.bind(this,i,void 0,!0)):e.defaultSection().appendItem(t,(()=>{s.userMetrics.issuesPanelOpenedFrom(s.UserMetrics.IssueOpener.HamburgerMenu),this.showView(i,void 0,!0)}))}}appendTab(e,t){this.tabbedPaneInternal.appendTab(e.viewId(),e.title(),new Ri(e),void 0,!1,e.isCloseable()||e.isTransient(),e.isPreviewFeature(),t)}appendView(e,t){if(this.tabbedPaneInternal.hasTab(e.viewId()))return;const i=Wi.get(e);let n;i&&i!==this&&i.removeView(e),Wi.set(e,this),this.manager.views.set(e.viewId(),e),this.views.set(e.viewId(),e);const s=this.tabbedPaneInternal.tabIds();if(this.allowReorder){const t=this.tabOrderSetting.get(),i=t[e.viewId()];for(let e=0;i&&e<s.length;++e)if(t[s[e]]&&t[s[e]]>i){n=e;break}}else if(t)for(let e=0;e<s.length;++e)if(s[e]===t.viewId()){n=e;break}if(this.appendTab(e,n),e.isCloseable()){const t=this.closeableTabSetting.get(),i=e.viewId();t[i]||(t[i]=!0,this.closeableTabSetting.set(t))}this.persistTabOrder()}async showView(e,t,i,n,s=!0){this.appendView(e,t),s&&this.tabbedPaneInternal.selectTab(e.viewId(),i),n||this.tabbedPaneInternal.focus();const o=this.tabbedPaneInternal.tabView(e.viewId());await o.materialize()}removeView(e){this.tabbedPaneInternal.hasTab(e.viewId())&&(Wi.delete(e),this.manager.views.delete(e.viewId()),this.tabbedPaneInternal.closeTab(e.viewId()),this.views.delete(e.viewId()))}tabSelected(e){const{tabId:t}=e.data;this.lastSelectedTabSetting&&e.data.isUserGesture&&this.lastSelectedTabSetting.set(t)}tabClosed(e){const{tabId:t}=e.data,i=this.closeableTabSetting.get();i[t]&&(i[t]=!1,this.closeableTabSetting.set(i));const n=this.views.get(t);n&&n.disposeView()}persistTabOrder(){const e=this.tabbedPaneInternal.tabIds(),t={};for(let i=0;i<e.length;i++)t[e[i]]=(i+1)*Fi.orderStep;const i=this.tabOrderSetting.get(),n=Object.keys(i);n.sort(((e,t)=>i[e]-i[t]));let s=0;for(const e of n)e in t?s=t[e]:t[e]=++s;this.tabOrderSetting.set(t)}getCloseableTabSetting(){return this.closeableTabSetting.get()}static orderStep=10}class Hi extends Bi{vbox;expandableContainers;constructor(e,t,i){const n=new _t;super(e,n,t),this.vbox=n,V(n.element),this.expandableContainers=new Map,i&&this.appendApplicableItems(i)}appendView(e,t){const i=Wi.get(e);i&&i!==this&&i.removeView(e);let n=this.expandableContainers.get(e.viewId());if(!n){Wi.set(e,this),this.manager.views.set(e.viewId(),e),n=new Ai(e);let i=null;if(t){const e=Oi.get(t);i=e?e.element:null}n.show(this.vbox.contentElement,i),this.expandableContainers.set(e.viewId(),n)}}async showView(e,t){this.appendView(e,t);const i=this.expandableContainers.get(e.viewId());i&&await i.expand()}removeView(e){const t=this.expandableContainers.get(e.viewId());t&&(t.detach(),this.expandableContainers.delete(e.viewId()),Wi.delete(e),this.manager.views.delete(e.viewId()))}appendApplicableItems(e){for(const t of this.manager.viewsForLocation(e))this.appendView(t)}}var zi=Object.freeze({__proto__:null,defaultOptionsForTabs:Ti,PreRegisteredView:Mi,ViewManager:Pi,ContainerWidget:Ri,getRegisteredViewExtensions:vi,maybeRemoveViewExtension:function(e){const t=bi.findIndex((t=>t.viewId()===e));return!(t<0||!fi.delete(e))&&(bi.splice(t,1),!0)},registerViewExtension:function(e){const t=e.id;fi.add(t),bi.push(new Mi(e))},getRegisteredLocationResolvers:Ei,registerLocationResolver:function(e){const t=e.name;if(xi.has(t))throw new Error(`Duplicate view location name registration '${t}'`);xi.add(t),wi.push(e)},get ViewLocationCategory(){return Ii},getLocalizedViewLocationCategory:function(e){switch(e){case Ii.ELEMENTS:return gi(mi.elements);case Ii.DRAWER:return gi(mi.drawer);case Ii.DRAWER_SIDEBAR:return gi(mi.drawer_sidebar);case Ii.PANEL:return gi(mi.panel);case Ii.NETWORK:return gi(mi.network);case Ii.SETTINGS:return gi(mi.settings);case Ii.SOURCES:return gi(mi.sources);case Ii.NONE:return t.i18n.lockedString("")}},resetViewRegistration:function(){bi.length=0,wi.length=0,xi.clear(),fi.clear()}}),Ni={cssContent:".tabbed-pane-header-tab,\n.tabbed-pane-header-tab.selected{height:26px;margin:0;border:none;border-left:2px solid transparent;border-right:2px solid transparent}.tabbed-pane-header-tab.selected{border-width:0 2px}.tabbed-pane-header-contents{margin-left:0}.tabbed-pane-left-toolbar{margin-right:0!important}"};const _i={moreTools:"More Tools",closeDrawer:"Close drawer",panels:"Panels",reloadDevtools:"Reload DevTools",moveToTop:"Move to top",moveToBottom:"Move to bottom",devToolsLanguageMissmatch:"DevTools is now available in {PH1}!",setToBrowserLanguage:"Always match Chrome's language",setToSpecificLanguage:"Switch DevTools to {PH1}",mainToolbar:"Main toolbar",drawer:"Tool drawer",drawerShown:"Drawer shown",drawerHidden:"Drawer hidden",selectOverrideFolder:"Select a folder to store override files in.",selectFolder:"Select folder"},Vi=t.i18n.registerUIStrings("ui/legacy/InspectorView.ts",_i),Ui=t.i18n.getLocalizedString.bind(void 0,Vi);let Ki,ji=null;class qi extends _t{drawerSplitWidget;tabDelegate;drawerTabbedLocation;drawerTabbedPane;infoBarDiv;tabbedLocation;tabbedPane;keyDownBound;currentPanelLocked;focusRestorer;ownerSplitWidget;reloadRequiredInfobar;#t;constructor(){super(),Ks.setContainer(this.element),this.setMinimumSize(250,72),this.drawerSplitWidget=new Zt(!1,!0,"Inspector.drawerSplitViewState",200,200),this.drawerSplitWidget.hideSidebar(),this.drawerSplitWidget.enableShowModeSaving(),this.drawerSplitWidget.show(this.element),this.tabDelegate=new $i,this.drawerTabbedLocation=Pi.instance().createTabbedLocation(this.showDrawer.bind(this,!1),"drawer-view",!0,!0);this.drawerTabbedLocation.enableMoreTabsButton().setTitle(Ui(_i.moreTools)),this.drawerTabbedPane=this.drawerTabbedLocation.tabbedPane(),this.drawerTabbedPane.setMinimumSize(0,27),this.drawerTabbedPane.element.classList.add("drawer-tabbed-pane");const n=new Pn(Ui(_i.closeDrawer),"cross");n.addEventListener(Pn.Events.Click,this.closeDrawer,this),this.drawerTabbedPane.addEventListener(hi.TabSelected,this.tabSelected,this),this.drawerTabbedPane.setTabDelegate(this.tabDelegate);const o=this.drawerTabbedPane.element;Y(o),be(o,Ui(_i.drawer)),this.drawerSplitWidget.installResizer(this.drawerTabbedPane.headerElement()),this.drawerSplitWidget.setSidebarWidget(this.drawerTabbedPane),this.drawerTabbedPane.rightToolbar().appendToolbarItem(n),this.tabbedLocation=Pi.instance().createTabbedLocation(s.InspectorFrontendHost.InspectorFrontendHostInstance.bringToFront.bind(s.InspectorFrontendHost.InspectorFrontendHostInstance),"panel",!0,!0,i.Runtime.Runtime.queryParam("panel")),this.tabbedPane=this.tabbedLocation.tabbedPane(),this.tabbedPane.element.classList.add("main-tabbed-pane");const r=i.Runtime.Runtime.queryParam(i.Runtime.ConditionName.CAN_DOCK)?"69px":"41px";this.tabbedPane.leftToolbar().element.style.minWidth=r,this.tabbedPane.registerRequiredCSS(Ni),this.tabbedPane.addEventListener(hi.TabSelected,this.tabSelected,this),this.tabbedPane.setAccessibleName(Ui(_i.panels)),this.tabbedPane.setTabDelegate(this.tabDelegate);const a=this.tabbedPane.headerElement();if($(a),be(a,Ui(_i.mainToolbar)),s.userMetrics.setLaunchPanel(this.tabbedPane.selectedTabId),s.InspectorFrontendHost.isUnderTest()&&this.tabbedPane.setAutoSelectFirstItemOnShow(!1),this.drawerSplitWidget.setMainWidget(this.tabbedPane),this.keyDownBound=this.keyDown.bind(this),s.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(s.InspectorFrontendHostAPI.Events.ShowPanel,function({data:e}){this.showPanel(e)}.bind(this)),function(){if(Gi().get())return!1;const i=e.Settings.Settings.instance().moduleSetting("language").get();if("en-US"!==i)return!1;return!t.DevToolsLocale.localeLanguagesMatch(navigator.language,i)&&t.DevToolsLocale.DevToolsLocale.instance().languageIsSupportedByDevTools(navigator.language)}()){const i=function(){const i=t.DevToolsLocale.DevToolsLocale.instance(),n=i.lookupClosestDevToolsLocale(navigator.language),s=new Intl.Locale(n),o=new Intl.DisplayNames([i.locale],{type:"language"}).of(s.language||"en")||"English",r=e.Settings.Settings.instance().moduleSetting("language");return new yt(Ct.Info,Ui(_i.devToolsLanguageMissmatch,{PH1:o}),[{text:Ui(_i.setToBrowserLanguage),highlight:!0,delegate:()=>{r.set("browserLanguage"),Gi().set(!0),Xi()},dismiss:!0},{text:Ui(_i.setToSpecificLanguage,{PH1:o}),highlight:!0,delegate:()=>{r.set(n),Gi().set(!0),Xi()},dismiss:!0}],Gi())}();i.setParentView(this),this.attachInfobar(i)}}static instance(e={forceNew:null}){const{forceNew:t}=e;return ji&&!t||(ji=new qi),ji}static maybeGetInspectorViewInstance(){return ji}static removeInstance(){ji=null}wasShown(){this.element.ownerDocument.addEventListener("keydown",this.keyDownBound,!1)}willHide(){this.element.ownerDocument.removeEventListener("keydown",this.keyDownBound,!1)}resolveLocation(e){return"drawer-view"===e?this.drawerTabbedLocation:"panel"===e?this.tabbedLocation:null}async createToolbars(){await this.tabbedPane.leftToolbar().appendItemsAtLocation("main-toolbar-left"),await this.tabbedPane.rightToolbar().appendItemsAtLocation("main-toolbar-right")}addPanel(e){this.tabbedLocation.appendView(e)}hasPanel(e){return this.tabbedPane.hasTab(e)}async panel(e){const t=Pi.instance().view(e);if(!t)throw new Error(`Expected view for panel '${e}'`);return t.widget()}onSuspendStateChanged(e){this.currentPanelLocked=e,this.tabbedPane.setCurrentTabLocked(this.currentPanelLocked),this.tabbedPane.leftToolbar().setEnabled(!this.currentPanelLocked),this.tabbedPane.rightToolbar().setEnabled(!this.currentPanelLocked)}canSelectPanel(e){return!this.currentPanelLocked||this.tabbedPane.selectedTabId===e}async showPanel(e){await Pi.instance().showView(e)}setPanelIcon(e,t){const i=this.getTabbedPaneForTabId(e);i&&i.setTabIcon(e,t)}emitDrawerChangeEvent(e){const t=new CustomEvent(Qi.DrawerChange,{bubbles:!0,cancelable:!0,detail:{isDrawerOpen:e}});document.body.dispatchEvent(t)}getTabbedPaneForTabId(e){return this.tabbedPane.hasTab(e)?this.tabbedPane:this.drawerTabbedPane.hasTab(e)?this.drawerTabbedPane:null}currentPanelDeprecated(){return Pi.instance().materializedWidget(this.tabbedPane.selectedTabId||"")}showDrawer(e){this.drawerTabbedPane.isShowing()||(this.drawerSplitWidget.showBoth(),this.focusRestorer=e?new Ut(this.drawerTabbedPane):null,this.emitDrawerChangeEvent(!0),ke(Ui(_i.drawerShown)))}drawerVisible(){return this.drawerTabbedPane.isShowing()}closeDrawer(){this.drawerTabbedPane.isShowing()&&(this.focusRestorer&&this.focusRestorer.restore(),this.drawerSplitWidget.hideSidebar(!0),this.emitDrawerChangeEvent(!1),ke(Ui(_i.drawerHidden)))}setDrawerMinimized(e){this.drawerSplitWidget.setSidebarMinimized(e),this.drawerSplitWidget.setResizable(!e)}isDrawerMinimized(){return this.drawerSplitWidget.isSidebarMinimized()}closeDrawerTab(e,t){this.drawerTabbedPane.closeTab(e,t),s.userMetrics.panelClosed(e)}keyDown(t){const i=t;if(!Ge.eventHasCtrlEquivalentKey(i)||i.altKey||i.shiftKey)return;if(e.Settings.moduleSetting("shortcutPanelSwitch").get()){let e=-1;if(i.keyCode>48&&i.keyCode<58?e=i.keyCode-49:i.keyCode>96&&i.keyCode<106&&i.location===KeyboardEvent.DOM_KEY_LOCATION_NUMPAD&&(e=i.keyCode-97),-1!==e){const i=this.tabbedPane.tabIds()[e];i&&(Qs.hasInstance()||this.currentPanelLocked||this.showPanel(i),t.consume(!0))}}}onResize(){Ks.containerMoved(this.element)}topResizerElement(){return this.tabbedPane.headerElement()}toolbarItemResized(){this.tabbedPane.headerResized()}tabSelected(e){const{tabId:t}=e.data;s.userMetrics.panelShown(t)}setOwnerSplit(e){this.ownerSplitWidget=e}ownerSplit(){return this.ownerSplitWidget||null}minimize(){this.ownerSplitWidget&&this.ownerSplitWidget.setSidebarMinimized(!0)}restore(){this.ownerSplitWidget&&this.ownerSplitWidget.setSidebarMinimized(!1)}displayReloadRequiredWarning(e){if(!this.reloadRequiredInfobar){const t=new yt(Ct.Info,e,[{text:Ui(_i.reloadDevtools),highlight:!0,delegate:()=>Xi(),dismiss:!1}]);t.setParentView(this),this.attachInfobar(t),this.reloadRequiredInfobar=t,t.setCloseCallback((()=>{delete this.reloadRequiredInfobar}))}}displaySelectOverrideFolderInfobar(e){if(!this.#t){const t=new yt(Ct.Info,Ui(_i.selectOverrideFolder),[{text:Ui(_i.selectFolder),highlight:!0,delegate:()=>e(),dismiss:!0}]);t.setParentView(this),this.attachInfobar(t),this.#t=t,t.setCloseCallback((()=>{this.#t=void 0}))}}createInfoBarDiv(){this.infoBarDiv||(this.infoBarDiv=document.createElement("div"),this.infoBarDiv.classList.add("flex-none"),this.contentElement.insertBefore(this.infoBarDiv,this.contentElement.firstChild))}attachInfobar(e){this.createInfoBarDiv(),this.infoBarDiv?.appendChild(e.element)}}function Gi(){return e.Settings.Settings.instance().createSetting("disableLocaleInfoBar",!1)}function Xi(){mt.instance().canDock()&&"undocked"===mt.instance().dockSide()&&s.InspectorFrontendHost.InspectorFrontendHostInstance.setIsDocked(!0,(function(){})),s.InspectorFrontendHost.InspectorFrontendHostInstance.reattach((()=>window.location.reload()))}class Yi{static instance(e={forceNew:null}){const{forceNew:t}=e;return Ki&&!t||(Ki=new Yi),Ki}handleAction(e,t){switch(t){case"main.toggle-drawer":return qi.instance().drawerVisible()?qi.instance().closeDrawer():qi.instance().showDrawer(!0),!0;case"main.next-tab":return qi.instance().tabbedPane.selectNextTab(),qi.instance().tabbedPane.focus(),!0;case"main.previous-tab":return qi.instance().tabbedPane.selectPrevTab(),qi.instance().tabbedPane.focus(),!0}return!1}}class $i{closeTabs(e,t){e.closeTabs(t,!0),t.forEach((e=>{s.userMetrics.panelClosed(e)}))}moveToDrawer(e){s.userMetrics.actionTaken(s.UserMetrics.Action.TabMovedToDrawer),Pi.instance().moveView(e,"drawer-view")}moveToMainPanel(e){s.userMetrics.actionTaken(s.UserMetrics.Action.TabMovedToMainPanel),Pi.instance().moveView(e,"panel")}onContextMenu(e,t){if("console"===e||"console-view"===e)return;"drawer-view"===Pi.instance().locationNameForViewId(e)?t.defaultSection().appendItem(Ui(_i.moveToTop),this.moveToMainPanel.bind(this,e)):t.defaultSection().appendItem(Ui(_i.moveToBottom),this.moveToDrawer.bind(this,e))}}var Qi;(Qi||(Qi={})).DrawerChange="drawerchange";var Zi=Object.freeze({__proto__:null,InspectorView:qi,ActionDelegate:Yi,InspectorViewTabDelegate:$i,get Events(){return Qi}});const Ji={srequiresReload:"*Requires reload",oneOrMoreSettingsHaveChanged:"One or more settings have changed which requires a reload to take effect."},en=t.i18n.registerUIStrings("ui/legacy/SettingsUI.ts",Ji),tn=t.i18n.getLocalizedString.bind(void 0,en),nn=function(e,t){const i=e;function n(){i.checked!==t.get()&&(i.checked=t.get())}t.addChangeListener(n),n(),i.addEventListener("change",(function(){t.get()!==i.checked&&t.set(i.checked)}),!1)};var sn,on=Object.freeze({__proto__:null,createSettingCheckbox:function(e,t,i,n){const s=ys.create(e);n&&ii.install(s,n);const o=s.checkboxElement;if(o.name=e,nn(o,t),i)return s;const r=document.createElement("p");return r.appendChild(s),r},bindCheckbox:nn,createCustomSetting:function(e,t){const i=document.createElement("p");i.classList.add("settings-select");const n=i.createChild("label");return n.textContent=e,A(n,t),i.appendChild(t),i},createControlForSetting:function(t,i){const n=t.title();switch(t.type()){case e.Settings.SettingType.BOOLEAN:{const e=new l.SettingCheckbox.SettingCheckbox;return e.data={setting:t},e}case e.Settings.SettingType.ENUM:return Array.isArray(t.options())?function(e,t,i,n,s){const o=document.createElement("div"),r=o.createChild("p");r.classList.add("settings-select");const a=r.createChild("label"),h=r.createChild("select","chrome-select");a.textContent=e,s&&(o.classList.add("chrome-select-label"),a.createChild("p").textContent=s),A(a,h);for(const e of t)e.text&&"string"==typeof e.value&&h.add(new Option(e.text,e.value));let d=null;i&&(d=o.createChild("span","reload-warning hidden"),d.textContent=tn(Ji.srequiresReload),O(d));const{deprecation:c}=n;if(c){const e=new l.SettingDeprecationWarning.SettingDeprecationWarning;e.data=c,a.appendChild(e)}return n.addChangeListener(u),u(),h.addEventListener("change",(function(){n.set(t[h.selectedIndex].value),d&&(d.classList.remove("hidden"),qi.instance().displayReloadRequiredWarning(tn(Ji.oneOrMoreSettingsHaveChanged)))}),!1),o;function u(){const e=n.get();for(let i=0;i<t.length;i++)t[i].value===e&&(h.selectedIndex=i);h.disabled=n.disabled()}}(n,t.options(),t.reloadRequired(),t,i):(console.error("Enum setting defined without options"),null);default:return console.error("Invalid setting type: "+t.type()),null}}});class rn extends e.ObjectWrapper.ObjectWrapper{items;constructor(e){super(),this.items=e||[]}[Symbol.iterator](){return this.items[Symbol.iterator]()}get length(){return this.items.length}at(e){return this.items[e]}every(e){return this.items.every(e)}filter(e){return this.items.filter(e)}find(e){return this.items.find(e)}findIndex(e){return this.items.findIndex(e)}indexOf(e,t){return this.items.indexOf(e,t)}insert(e,t){this.items.splice(e,0,t),this.replaced(e,[],1)}insertWithComparator(e,t){this.insert(n.ArrayUtilities.lowerBound(this.items,e,t),e)}join(e){return this.items.join(e)}remove(e){const t=this.items[e];return this.items.splice(e,1),this.replaced(e,[t],0),t}replace(e,t,i){const n=this.items[e];return this.items[e]=t,this.replaced(e,[n],1,i),n}replaceRange(e,t,i){let n;if(i.length<1e4)n=this.items.splice(e,t-e,...i);else{n=this.items.slice(e,t);const s=this.items.slice(0,e),o=this.items.slice(t);this.items=[...s,...i,...o]}return this.replaced(e,n,i.length),n}replaceAll(e){const t=this.items.slice();return this.items=e,this.replaced(0,t,e.length),t}slice(e,t){return this.items.slice(e,t)}some(e){return this.items.some(e)}replaced(e,t,i,n){this.dispatchEventToListeners(sn.ItemsReplaced,{index:e,removed:t,inserted:i,keepSelectedIndex:n})}}(sn||(sn={})).ItemsReplaced="ItemsReplaced";var an,ln=Object.freeze({__proto__:null,ListModel:rn,get Events(){return sn}});!function(e){e.NonViewport="UI.ListMode.NonViewport",e.EqualHeightItems="UI.ListMode.EqualHeightItems",e.VariousHeightItems="UI.ListMode.VariousHeightItems"}(an||(an={}));class hn{element;topElement;bottomElement;firstIndex;lastIndex;renderedHeight;topHeight;bottomHeight;model;itemToElement;selectedIndexInternal;selectedItemInternal;delegate;mode;fixedHeight;variableOffsets;constructor(e,t,i){this.element=document.createElement("div"),this.element.style.overflowY="auto",this.topElement=this.element.createChild("div"),this.bottomElement=this.element.createChild("div"),this.firstIndex=0,this.lastIndex=0,this.renderedHeight=0,this.topHeight=0,this.bottomHeight=0,this.model=e,this.model.addEventListener(sn.ItemsReplaced,this.replacedItemsInRange,this),this.itemToElement=new Map,this.selectedIndexInternal=-1,this.selectedItemInternal=null,this.element.tabIndex=-1,this.element.addEventListener("click",this.onClick.bind(this),!1),this.element.addEventListener("keydown",this.onKeyDown.bind(this),!1),Q(this.element),this.delegate=t,this.mode=i||an.EqualHeightItems,this.fixedHeight=0,this.variableOffsets=new Int32Array(0),this.clearContents(),this.mode!==an.NonViewport&&this.element.addEventListener("scroll",(()=>{this.updateViewport(this.element.scrollTop,this.element.offsetHeight)}),!1)}setModel(e){this.itemToElement.clear();const t=this.model.length;this.model.removeEventListener(sn.ItemsReplaced,this.replacedItemsInRange,this),this.model=e,this.model.addEventListener(sn.ItemsReplaced,this.replacedItemsInRange,this),this.invalidateRange(0,t)}replacedItemsInRange(e){const t=e.data,i=t.index,n=i+t.removed.length,s=t.keepSelectedIndex,o=this.selectedItemInternal,r=o&&this.itemToElement.get(o)||null;for(let e=0;e<t.removed.length;e++)this.itemToElement.delete(t.removed[e]);if(this.invalidate(i,n,t.inserted),this.selectedIndexInternal>=n)this.selectedIndexInternal+=t.inserted-(n-i),this.selectedItemInternal=this.model.at(this.selectedIndexInternal);else if(this.selectedIndexInternal>=i){const e=s?i:i+t.inserted;let n=this.findFirstSelectable(e,1,!1);if(-1===n){const e=s?i:i-1;n=this.findFirstSelectable(e,-1,!1)}this.select(n,o,r)}}refreshItem(e){const t=this.model.indexOf(e);-1!==t?this.refreshItemByIndex(t):console.error("Item to refresh is not present")}refreshItemByIndex(e){const t=this.model.at(e);this.itemToElement.delete(t),this.invalidateRange(e,e+1),-1!==this.selectedIndexInternal&&this.select(this.selectedIndexInternal,null,null)}refreshAllItems(){this.itemToElement.clear(),this.invalidateRange(0,this.model.length),-1!==this.selectedIndexInternal&&this.select(this.selectedIndexInternal,null,null)}invalidateRange(e,t){this.invalidate(e,t,t-e)}viewportResized(){if(this.mode===an.NonViewport)return;const e=this.element.scrollTop,t=this.element.offsetHeight;this.clearViewport(),this.updateViewport(n.NumberUtilities.clamp(e,0,this.totalHeight()-t),t)}invalidateItemHeight(){this.mode===an.EqualHeightItems?(this.fixedHeight=0,this.model.length&&(this.itemToElement.clear(),this.invalidate(0,this.model.length,this.model.length))):console.error("Only supported in equal height items mode")}itemForNode(e){for(;e&&e.parentNodeOrShadowHost()!==this.element;)e=e.parentNodeOrShadowHost();if(!e)return null;const t=e,i=this.model.findIndex((e=>this.itemToElement.get(e)===t));return-1!==i?this.model.at(i):null}scrollItemIntoView(e,t){const i=this.model.indexOf(e);-1!==i?this.scrollIntoView(i,t):console.error("Attempt to scroll onto missing item")}selectedItem(){return this.selectedItemInternal}selectedIndex(){return this.selectedIndexInternal}selectItem(e,t,i){let n=-1;if(null!==e){if(n=this.model.indexOf(e),-1===n)return void console.error("Attempt to select missing item");if(!this.delegate.isItemSelectable(e))return void console.error("Attempt to select non-selectable item")}-1===n||i||this.scrollIntoView(n,t),this.selectedIndexInternal!==n&&this.select(n)}selectPreviousItem(e,t){if(-1===this.selectedIndexInternal&&!e)return!1;let i=-1===this.selectedIndexInternal?this.model.length-1:this.selectedIndexInternal-1;return i=this.findFirstSelectable(i,-1,Boolean(e)),-1!==i&&(this.scrollIntoView(i,t),this.select(i),!0)}selectNextItem(e,t){if(-1===this.selectedIndexInternal&&!e)return!1;let i=-1===this.selectedIndexInternal?0:this.selectedIndexInternal+1;return i=this.findFirstSelectable(i,1,Boolean(e)),-1!==i&&(this.scrollIntoView(i,t),this.select(i),!0)}selectItemPreviousPage(e){if(this.mode===an.NonViewport)return!1;let t=-1===this.selectedIndexInternal?this.model.length-1:this.selectedIndexInternal;return t=this.findPageSelectable(t,-1),-1!==t&&(this.scrollIntoView(t,e),this.select(t),!0)}selectItemNextPage(e){if(this.mode===an.NonViewport)return!1;let t=-1===this.selectedIndexInternal?0:this.selectedIndexInternal;return t=this.findPageSelectable(t,1),-1!==t&&(this.scrollIntoView(t,e),this.select(t),!0)}scrollIntoView(e,t){if(this.mode===an.NonViewport)return void this.elementAtIndex(e).scrollIntoViewIfNeeded(Boolean(t));const i=this.offsetAtIndex(e),s=this.offsetAtIndex(e+1),o=this.element.offsetHeight;if(t){const e=(i+s)/2-o/2;return void this.updateViewport(n.NumberUtilities.clamp(e,0,this.totalHeight()-o),o)}const r=this.element.scrollTop;i<r?this.updateViewport(i,o):s>r+o&&this.updateViewport(s-o,o)}onClick(e){const t=this.itemForNode(e.target);t&&this.delegate.isItemSelectable(t)&&this.selectItem(t)}onKeyDown(e){const t=e;let i=!1;switch(t.key){case"ArrowUp":i=this.selectPreviousItem(!0,!1);break;case"ArrowDown":i=this.selectNextItem(!0,!1);break;case"PageUp":i=this.selectItemPreviousPage(!1);break;case"PageDown":i=this.selectItemNextPage(!1)}i&&t.consume(!0)}totalHeight(){return this.offsetAtIndex(this.model.length)}indexAtOffset(e){if(this.mode===an.NonViewport)throw"There should be no offset conversions in non-viewport mode";return!this.model.length||e<0?0:this.mode===an.VariousHeightItems?Math.min(this.model.length-1,n.ArrayUtilities.lowerBound(this.variableOffsets,e,n.ArrayUtilities.DEFAULT_COMPARATOR,0,this.model.length)):(this.fixedHeight||this.measureHeight(),Math.min(this.model.length-1,Math.floor(e/this.fixedHeight)))}elementAtIndex(e){const t=this.model.at(e);let i=this.itemToElement.get(t);return i||(i=this.delegate.createElementForItem(t),this.itemToElement.set(t,i),this.updateElementARIA(i,e)),i}refreshARIA(){for(let e=this.firstIndex;e<=this.lastIndex;e++){const t=this.model.at(e),i=this.itemToElement.get(t);i&&this.updateElementARIA(i,e)}}updateElementARIA(e,t){ie(e)||J(e),we(e,this.model.length),xe(e,t+1)}offsetAtIndex(e){if(this.mode===an.NonViewport)throw new Error("There should be no offset conversions in non-viewport mode");return this.model.length?this.mode===an.VariousHeightItems?this.variableOffsets[e]:(this.fixedHeight||this.measureHeight(),e*this.fixedHeight):0}measureHeight(){this.fixedHeight=this.delegate.heightForItem(this.model.at(0)),this.fixedHeight||(this.fixedHeight=ps(this.elementAtIndex(0),this.element).height)}select(e,t,i){void 0===t&&(t=this.selectedItemInternal),void 0===i&&(i=this.itemToElement.get(t)||null),this.selectedIndexInternal=e,this.selectedItemInternal=-1===e?null:this.model.at(e);const n=this.selectedItemInternal,s=-1!==this.selectedIndexInternal?this.elementAtIndex(e):null;if(this.delegate.selectedItemChanged(t,n,i,s),!this.delegate.updateSelectedItemARIA(i,s)){if(i&&ue(i,!1),s){ue(s,!0);const e=s.textContent;e&&ke(e)}ve(this.element,s)}}findFirstSelectable(e,t,i){const n=this.model.length;if(!n)return-1;for(let s=0;s<=n;s++){if(e<0||e>=n){if(!i)return-1;e=(e+n)%n}if(this.delegate.isItemSelectable(this.model.at(e)))return e;e+=t}return-1}findPageSelectable(e,t){let i=-1;const n=this.offsetAtIndex(e),s=this.element.offsetHeight-1;for(;e>=0&&e<this.model.length;){if(this.delegate.isItemSelectable(this.model.at(e))){if(Math.abs(this.offsetAtIndex(e)-n)>=s)return e;i=e}e+=t}return i}reallocateVariableOffsets(e,t){if(this.variableOffsets.length<e){const i=new Int32Array(Math.max(e,2*this.variableOffsets.length));i.set(this.variableOffsets.slice(0,t),0),this.variableOffsets=i}else if(this.variableOffsets.length>=2*e){const i=new Int32Array(e);i.set(this.variableOffsets.slice(0,t),0),this.variableOffsets=i}}invalidate(e,t,i){if(this.mode===an.NonViewport)return void this.invalidateNonViewportMode(e,t-e,i);if(this.mode===an.VariousHeightItems){this.reallocateVariableOffsets(this.model.length+1,e+1);for(let t=e+1;t<=this.model.length;t++)this.variableOffsets[t]=this.variableOffsets[t-1]+this.delegate.heightForItem(this.model.at(t-1))}const s=this.element.offsetHeight,o=this.totalHeight(),r=this.element.scrollTop;if(this.renderedHeight<s||o<s)return this.clearViewport(),void this.updateViewport(n.NumberUtilities.clamp(r,0,o-s),s);const a=o-this.renderedHeight;if(t<=this.firstIndex){const n=this.topHeight+a;this.topElement.style.height=n+"px",this.element.scrollTop=r+a,this.topHeight=n,this.renderedHeight=o;const s=i-(t-e);return this.firstIndex+=s,void(this.lastIndex+=s)}if(e>=this.lastIndex){const e=this.bottomHeight+a;return this.bottomElement.style.height=e+"px",this.bottomHeight=e,void(this.renderedHeight=o)}this.clearViewport(),this.updateViewport(n.NumberUtilities.clamp(r,0,o-s),s),this.refreshARIA()}invalidateNonViewportMode(e,t,i){let n=this.topElement;for(let t=0;t<e;t++)n=n.nextElementSibling;for(;t--;)n.nextElementSibling.remove();for(;i--;)this.element.insertBefore(this.elementAtIndex(e+i),n.nextElementSibling)}clearViewport(){this.mode!==an.NonViewport?(this.firstIndex=0,this.lastIndex=0,this.renderedHeight=0,this.topHeight=0,this.bottomHeight=0,this.clearContents()):console.error("There should be no viewport updates in non-viewport mode")}clearContents(){this.topElement.style.height="0",this.bottomElement.style.height="0",this.element.removeChildren(),this.element.appendChild(this.topElement),this.element.appendChild(this.bottomElement)}updateViewport(e,t){if(this.mode===an.NonViewport)return void console.error("There should be no viewport updates in non-viewport mode");const i=this.totalHeight();if(!i)return this.firstIndex=0,this.lastIndex=0,this.topHeight=0,this.bottomHeight=0,this.renderedHeight=0,this.topElement.style.height="0",void(this.bottomElement.style.height="0");const n=this.indexAtOffset(e-t),s=this.indexAtOffset(e+2*t)+1;for(;this.firstIndex<Math.min(n,this.lastIndex);)this.elementAtIndex(this.firstIndex).remove(),this.firstIndex++;for(;this.lastIndex>Math.max(s,this.firstIndex);)this.elementAtIndex(this.lastIndex-1).remove(),this.lastIndex--;this.firstIndex=Math.min(this.firstIndex,s),this.lastIndex=Math.max(this.lastIndex,n);for(let e=this.firstIndex-1;e>=n;e--){const t=this.elementAtIndex(e);this.element.insertBefore(t,this.topElement.nextSibling)}for(let e=this.lastIndex;e<s;e++){const t=this.elementAtIndex(e);this.element.insertBefore(t,this.bottomElement)}this.firstIndex=n,this.lastIndex=s,this.topHeight=this.offsetAtIndex(n),this.topElement.style.height=this.topHeight+"px",this.bottomHeight=i-this.offsetAtIndex(s),this.bottomElement.style.height=this.bottomHeight+"px",this.renderedHeight=i,this.element.scrollTop=e}}var dn=Object.freeze({__proto__:null,get ListMode(){return an},ListControl:hn}),cn={cssContent:":host{display:flex;flex:auto}.suggest-box{flex:auto;background-color:var(--color-background);pointer-events:auto;margin-left:-3px;box-shadow:var(--drop-shadow);overflow-x:hidden}.suggest-box-content-item{padding:1px 0 1px 1px;margin:0;border:1px solid transparent;white-space:nowrap;display:flex;align-items:center;justify-content:space-between}.suggest-box-content-item.secondary{background-color:var(--color-background-elevation-1);justify-content:normal}.suggestion-title{overflow:hidden;text-overflow:ellipsis}.suggestion-title span{white-space:pre}.suggestion-subtitle{flex:auto;text-align:right;color:var(--color-text-secondary);margin-right:3px;overflow:hidden;text-overflow:ellipsis}.suggest-box-content-item devtools-icon{--icon-color:#000;margin-right:1px}.suggest-box-content-item .query{font-weight:bold}.suggest-box-content-item .spacer{display:inline-block;width:20px}.suggest-box-content-item.selected{background-color:var(--legacy-selection-bg-color)}.suggest-box-content-item.selected devtools-icon{--icon-color:#fff}.suggest-box-content-item.selected .suggestion-subtitle,\n.suggest-box-content-item.selected > span{color:var(--legacy-selection-fg-color)}.suggest-box-content-item:hover:not(.selected){background-color:var(--item-hover-color)}:host-context(.-theme-with-dark-background) .suggest-box-content-item devtools-icon{--icon-color:#fff}:host-context(.-theme-with-dark-background) .suggest-box-content-item.selected devtools-icon{--icon-color:#fff}@media (forced-colors: active){.suggest-box-content-item.selected{forced-color-adjust:none;background-color:Highlight}.suggest-box-content-item.selected > span{color:HighlightText}}"};const un={sSuggestionSOfS:"{PH1}, suggestion {PH2} of {PH3}",sSuggestionSSelected:"{PH1}, suggestion selected"},mn=t.i18n.registerUIStrings("ui/legacy/SuggestBox.ts",un),pn=t.i18n.getLocalizedString.bind(void 0,mn);class gn{suggestBoxDelegate;maxItemsHeight;rowHeight;userEnteredText;defaultSelectionIsDimmed;onlyCompletion;items;list;element;glassPane;constructor(e,t){this.suggestBoxDelegate=e,this.maxItemsHeight=t,this.rowHeight=17,this.userEnteredText="",this.defaultSelectionIsDimmed=!1,this.onlyCompletion=null,this.items=new rn,this.list=new hn(this.items,this,an.EqualHeightItems),this.element=this.list.element,this.element.classList.add("suggest-box"),this.element.addEventListener("mousedown",(e=>e.preventDefault()),!0),this.element.addEventListener("click",this.onClick.bind(this),!1),this.glassPane=new Ks,this.glassPane.setAnchorBehavior("PreferBottom"),this.glassPane.setOutsideClickCallback(this.hide.bind(this));o.createShadowRootWithCoreStyles(this.glassPane.contentElement,{cssFile:cn,delegatesFocus:void 0}).appendChild(this.element)}visible(){return this.glassPane.isShowing()}setPosition(e){this.glassPane.setContentAnchorBox(e)}setAnchorBehavior(e){this.glassPane.setAnchorBehavior(e)}updateMaxSize(e){const t=this.maxWidth(e),i=(this.maxItemsHeight?Math.min(this.maxItemsHeight,e.length):e.length)*this.rowHeight;this.glassPane.setMaxContentSize(new Ke(t,i))}maxWidth(e){if(!e.length)return 300;let t,i=-1/0;for(let n=0;n<e.length;n++){const s=(e[n].title||e[n].text).length+(e[n].subtitle||"").length;s>i&&(i=s,t=e[n])}const n=ps(this.createElementForItem(t),this.element).width+o.measuredScrollbarWidth(this.element.ownerDocument);return Math.min(300,n)}show(){if(this.visible())return;this.glassPane.show(document);this.rowHeight=ps(this.createElementForItem({text:"1",subtitle:"12"}),this.element).height,oe(this.suggestBoxDelegate.ariaControlledBy(),this.element),re(this.suggestBoxDelegate.ariaControlledBy(),!0)}hide(){this.visible()&&(this.glassPane.hide(),oe(this.suggestBoxDelegate.ariaControlledBy(),null),re(this.suggestBoxDelegate.ariaControlledBy(),!1))}applySuggestion(e){if(this.onlyCompletion)return ke(e?pn(un.sSuggestionSOfS,{PH1:this.onlyCompletion.text,PH2:this.list.selectedIndex()+1,PH3:this.items.length}):pn(un.sSuggestionSSelected,{PH1:this.onlyCompletion.text})),this.suggestBoxDelegate.applySuggestion(this.onlyCompletion,e),!0;const t=this.list.selectedItem();return t&&t.text&&ke(e?pn(un.sSuggestionSOfS,{PH1:t.title||t.text,PH2:this.list.selectedIndex()+1,PH3:this.items.length}):pn(un.sSuggestionSSelected,{PH1:t.title||t.text})),this.suggestBoxDelegate.applySuggestion(t,e),this.visible()&&Boolean(t)}acceptSuggestion(){const e=this.applySuggestion();return this.hide(),!!e&&(this.suggestBoxDelegate.acceptSuggestion(),!0)}createElementForItem(e){const t=this.userEnteredText,i=document.createElement("div");i.classList.add("suggest-box-content-item"),i.classList.add("source-code"),e.isSecondary&&i.classList.add("secondary"),i.tabIndex=-1;const s=50+t.length,o=n.StringUtilities.trimEndWithMaxLength((e.title||e.text).trim(),s).replace(/\n/g,"↵"),r=i.createChild("span","suggestion-title"),a=o.toLowerCase().indexOf(t.toLowerCase());if(a>0&&(r.createChild("span").textContent=o.substring(0,a)),a>-1&&(r.createChild("span","query").textContent=o.substring(a,a+t.length)),r.createChild("span").textContent=o.substring(a>-1?a+t.length:0),r.createChild("span","spacer"),e.subtitleRenderer){const t=e.subtitleRenderer.call(null);t.classList.add("suggestion-subtitle"),i.appendChild(t)}else if(e.subtitle){i.createChild("span","suggestion-subtitle").textContent=n.StringUtilities.trimEndWithMaxLength(e.subtitle,s-o.length)}return e.iconElement&&i.appendChild(e.iconElement),i}heightForItem(e){return this.rowHeight}isItemSelectable(e){return!0}selectedItemChanged(e,t,i,n){i&&i.classList.remove("selected","force-white-icons"),n&&(n.classList.add("selected"),n.classList.add("force-white-icons")),this.applySuggestion(!0)}updateSelectedItemARIA(e,t){return!1}onClick(e){const t=this.list.itemForNode(e.target);t&&(this.list.selectItem(t),this.acceptSuggestion(),e.consume(!0))}canShowBox(e,t,i,n){return!(!e||!e.length)&&(e.length>1||(!(t&&!t.isSecondary&&t.text.startsWith(n))||i&&t.text!==n))}updateSuggestions(e,t,i,n,s){this.onlyCompletion=null;const o=i?t.reduce(((e,t)=>(e.priority||0)>=(t.priority||0)?e:t)):null;this.canShowBox(t,o,n,s)?(this.userEnteredText=s,this.show(),this.updateMaxSize(t),this.glassPane.setContentAnchorBox(e),this.list.invalidateItemHeight(),this.items.replaceAll(t),o&&!o.isSecondary?this.list.selectItem(o,!0):this.list.selectItem(null)):(1===t.length&&(this.onlyCompletion=t[0],this.applySuggestion(!0)),this.hide())}keyPressed(e){switch(e.key){case"Enter":return this.enterKeyPressed();case"ArrowUp":return this.list.selectPreviousItem(!0,!1);case"ArrowDown":return this.list.selectNextItem(!0,!1);case"PageUp":return this.list.selectItemPreviousPage(!1);case"PageDown":return this.list.selectItemNextPage(!1)}return!1}enterKeyPressed(){const e=Boolean(this.list.selectedItem())||Boolean(this.onlyCompletion);return this.acceptSuggestion(),e}}var bn=Object.freeze({__proto__:null,SuggestBox:gn}),fn={cssContent:'.text-prompt-root{display:flex;align-items:center}.text-prompt-editing{box-shadow:var(--drop-shadow);background-color:var(--color-background);text-overflow:clip!important;padding-left:2px;margin-left:-2px;padding-right:2px;margin-right:-2px;margin-bottom:-1px;padding-bottom:1px;opacity:100%!important}.text-prompt{cursor:text;overflow-x:visible}.text-prompt::-webkit-scrollbar{display:none}.text-prompt-editing > .text-prompt{color:var(--color-text-primary)!important;text-decoration:none!important;white-space:pre}.text-prompt > .auto-complete-text{color:var(--color-text-secondary)!important}.text-prompt[data-placeholder]:empty::before{content:attr(data-placeholder);color:var(--color-text-secondary)}.text-prompt:not([data-placeholder]):empty::after{content:"\\00A0";width:0;display:block}.text-prompt.disabled{opacity:50%;cursor:default}.text-prompt-editing br{display:none}.text-prompt-root:not(:focus-within) ::selection{background:transparent}@media (forced-colors: active){.text-prompt[data-placeholder]:empty::before{color:GrayText!important}.text-prompt.disabled{opacity:100%}}'};class vn extends e.ObjectWrapper.ObjectWrapper{proxyElement;proxyElementDisplay;autocompletionTimeout;titleInternal;queryRange;previousText;currentSuggestion;completionRequestId;ghostTextElement;leftParenthesesIndices;loadCompletions;completionStopCharacters;usesSuggestionBuilder;elementInternal;boundOnKeyDown;boundOnInput;boundOnMouseWheel;boundClearAutocomplete;contentElement;suggestBox;isEditing;focusRestorer;blurListener;oldTabIndex;completeTimeout;disableDefaultSuggestionForEmptyInputInternal;constructor(){super(),this.proxyElementDisplay="inline-block",this.autocompletionTimeout=wn,this.titleInternal="",this.queryRange=null,this.previousText="",this.currentSuggestion=null,this.completionRequestId=0,this.ghostTextElement=document.createElement("span"),this.ghostTextElement.classList.add("auto-complete-text"),this.ghostTextElement.setAttribute("contenteditable","false"),this.leftParenthesesIndices=[],ee(this.ghostTextElement)}initialize(e,t,i){this.loadCompletions=e,this.completionStopCharacters=t||" =:[({;,!+-*/&|^<>.",this.usesSuggestionBuilder=i||!1}setAutocompletionTimeout(e){this.autocompletionTimeout=e}renderAsBlock(){this.proxyElementDisplay="block"}attach(e){return this.attachInternal(e)}attachAndStartEditing(e,t){const i=this.attachInternal(e);return this.startEditing(t),i}attachInternal(e){if(this.proxyElement)throw"Cannot attach an attached TextPrompt";return this.elementInternal=e,this.boundOnKeyDown=this.onKeyDown.bind(this),this.boundOnInput=this.onInput.bind(this),this.boundOnMouseWheel=this.onMouseWheel.bind(this),this.boundClearAutocomplete=this.clearAutocomplete.bind(this),this.proxyElement=e.ownerDocument.createElement("span"),c.ThemeSupport.instance().appendStyle(this.proxyElement,fn),this.contentElement=this.proxyElement.createChild("div","text-prompt-root"),this.proxyElement.style.display=this.proxyElementDisplay,e.parentElement&&e.parentElement.insertBefore(this.proxyElement,e),this.contentElement.appendChild(e),this.elementInternal.classList.add("text-prompt"),K(this.elementInternal),he(this.elementInternal,le.both),ce(this.elementInternal,"listbox"),this.elementInternal.setAttribute("contenteditable","plaintext-only"),this.element().addEventListener("keydown",this.boundOnKeyDown,!1),this.elementInternal.addEventListener("input",this.boundOnInput,!1),this.elementInternal.addEventListener("wheel",this.boundOnMouseWheel,!1),this.elementInternal.addEventListener("selectstart",this.boundClearAutocomplete,!1),this.elementInternal.addEventListener("blur",this.boundClearAutocomplete,!1),this.suggestBox=new gn(this,20),this.titleInternal&&ii.install(this.proxyElement,this.titleInternal),this.proxyElement}element(){if(!this.elementInternal)throw new Error("Expected an already attached element!");return this.elementInternal}detach(){this.removeFromElement(),this.focusRestorer&&this.focusRestorer.restore(),this.proxyElement&&this.proxyElement.parentElement&&(this.proxyElement.parentElement.insertBefore(this.element(),this.proxyElement),this.proxyElement.remove()),delete this.proxyElement,this.element().classList.remove("text-prompt"),this.element().removeAttribute("contenteditable"),this.element().removeAttribute("role"),de(this.element()),ce(this.element(),"false")}textWithCurrentSuggestion(){const e=this.text();if(!this.queryRange||!this.currentSuggestion)return e;const t=this.currentSuggestion.text;return e.substring(0,this.queryRange.startColumn)+t+e.substring(this.queryRange.endColumn)}text(){let e=this.element().textContent||"";if(this.ghostTextElement.parentNode){const t=this.ghostTextElement.textContent||"";e=e.substring(0,e.length-t.length)}return e}setText(e){this.clearAutocomplete(),this.element().textContent=e,this.previousText=this.text(),this.element().hasFocus()&&(this.moveCaretToEndOfPrompt(),this.element().scrollIntoView())}setSelectedRange(e,t){if(e<0)throw new RangeError("Selected range start must be a nonnegative integer");const i=this.element().textContent,n=i?i.length:0;t>n&&(t=n),t<e&&(t=e);const s=this.element().childNodes[0],o=new Range;o.setStart(s,e),o.setEnd(s,t);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(o))}focus(){this.element().focus()}title(){return this.titleInternal}setTitle(e){this.titleInternal=e,this.proxyElement&&ii.install(this.proxyElement,e)}setPlaceholder(e,t){e?(this.element().setAttribute("data-placeholder",e),ne(this.element(),t||e)):(this.element().removeAttribute("data-placeholder"),ne(this.element(),null))}setEnabled(e){e?this.element().setAttribute("contenteditable","plaintext-only"):this.element().removeAttribute("contenteditable"),this.element().classList.toggle("disabled",!e)}removeFromElement(){this.clearAutocomplete(),this.element().removeEventListener("keydown",this.boundOnKeyDown,!1),this.element().removeEventListener("input",this.boundOnInput,!1),this.element().removeEventListener("selectstart",this.boundClearAutocomplete,!1),this.element().removeEventListener("blur",this.boundClearAutocomplete,!1),this.isEditing&&this.stopEditing(),this.suggestBox&&this.suggestBox.hide()}startEditing(e){this.isEditing=!0,this.contentElement&&this.contentElement.classList.add("text-prompt-editing"),this.focusRestorer=new cs(this.element()),e&&(this.blurListener=e,this.element().addEventListener("blur",this.blurListener,!1)),this.oldTabIndex=this.element().tabIndex,this.element().tabIndex<0&&(this.element().tabIndex=0),this.text()||this.autoCompleteSoon()}stopEditing(){this.element().tabIndex=this.oldTabIndex,this.blurListener&&this.element().removeEventListener("blur",this.blurListener,!1),this.contentElement&&this.contentElement.classList.remove("text-prompt-editing"),delete this.isEditing}onMouseWheel(e){}onKeyDown(e){let t=!1;const i=e;if(this.isSuggestBoxVisible()&&this.suggestBox&&this.suggestBox.keyPressed(i))i.consume(!0);else{switch(i.key){case"Tab":t=this.tabKeyPressed(i);break;case"ArrowLeft":case"ArrowUp":case"PageUp":case"Home":this.clearAutocomplete();break;case"PageDown":case"ArrowRight":case"ArrowDown":case"End":this.isCaretAtEndOfPrompt()?t=this.acceptAutoComplete():this.clearAutocomplete();break;case"Escape":this.isSuggestBoxVisible()&&(this.clearAutocomplete(),t=!0);break;case" ":!i.ctrlKey||i.metaKey||i.altKey||i.shiftKey||(this.autoCompleteSoon(!0),t=!0)}"Enter"===i.key&&i.preventDefault(),t&&i.consume(!0)}}acceptSuggestionOnStopCharacters(e){if(!(this.currentSuggestion&&this.queryRange&&1===e.length&&this.completionStopCharacters&&this.completionStopCharacters.includes(e)))return!1;const t=this.text().substring(this.queryRange.startColumn,this.queryRange.endColumn);return!(!t||!this.currentSuggestion.text.startsWith(t+e))&&(this.queryRange.endColumn+=1,this.acceptAutoComplete())}onInput(e){const t=e;let i=this.text();const s=t.data;"insertFromPaste"===t.inputType&&i.includes("\n")&&(i=n.StringUtilities.stripLineBreaks(i),this.setText(i));const o=this.getCaretPosition();if(")"===s&&o>=0&&this.leftParenthesesIndices.length>0){if(")"===i[o]&&this.tryMatchingLeftParenthesis(o))return i=i.substring(0,o)+i.substring(o+1),void this.setText(i)}if(s&&!this.acceptSuggestionOnStopCharacters(s)){const e=i.startsWith(this.previousText)||this.previousText.startsWith(i);this.queryRange&&e&&(this.queryRange.endColumn+=i.length-this.previousText.length)}this.refreshGhostText(),this.previousText=i,this.dispatchEventToListeners(xn.TextChanged),this.autoCompleteSoon()}acceptAutoComplete(){let e=!1;return this.isSuggestBoxVisible()&&this.suggestBox&&(e=this.suggestBox.acceptSuggestion()),e||(e=this.acceptSuggestionInternal()),this.usesSuggestionBuilder&&e&&this.autoCompleteSoon(),e}clearAutocomplete(){const e=this.textWithCurrentSuggestion();this.isSuggestBoxVisible()&&this.suggestBox&&this.suggestBox.hide(),this.clearAutocompleteTimeout(),this.queryRange=null,this.refreshGhostText(),e!==this.textWithCurrentSuggestion()&&this.dispatchEventToListeners(xn.TextChanged)}refreshGhostText(){this.currentSuggestion&&this.currentSuggestion.hideGhostText?this.ghostTextElement.remove():this.queryRange&&this.currentSuggestion&&this.isCaretAtEndOfPrompt()&&this.currentSuggestion.text.startsWith(this.text().substring(this.queryRange.startColumn))?(this.ghostTextElement.textContent=this.currentSuggestion.text.substring(this.queryRange.endColumn-this.queryRange.startColumn),this.element().appendChild(this.ghostTextElement)):this.ghostTextElement.remove()}clearAutocompleteTimeout(){this.completeTimeout&&(clearTimeout(this.completeTimeout),delete this.completeTimeout),this.completionRequestId++}autoCompleteSoon(e){const t=this.isSuggestBoxVisible()||e;this.completeTimeout||(this.completeTimeout=window.setTimeout(this.complete.bind(this,e),t?0:this.autocompletionTimeout))}async complete(e){this.clearAutocompleteTimeout();const t=this.element().getComponentSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);let s;if((e||this.isCaretAtEndOfPrompt()||this.isSuggestBoxVisible())&&t.isCollapsed||(s=!0),s)return void this.clearAutocomplete();const o=n.DOMUtilities.rangeOfWord(i.startContainer,i.startOffset,this.completionStopCharacters,this.element(),"backward"),r=o.cloneRange();r.collapse(!0),r.setStartBefore(this.element());const a=++this.completionRequestId,l=await this.loadCompletions.call(null,r.toString(),o.toString(),Boolean(e));this.completionsReady(a,t,o,Boolean(e),l)}disableDefaultSuggestionForEmptyInput(){this.disableDefaultSuggestionForEmptyInputInternal=!0}boxForAnchorAtStart(e,t){const i=e.getRangeAt(0).cloneRange(),n=document.createElement("span");n.textContent="​",t.insertNode(n);const s=n.boxInWindow(window);return n.remove(),e.removeAllRanges(),e.addRange(i),s}additionalCompletions(e){return[]}completionsReady(e,t,i,n,s){if(this.completionRequestId!==e)return;const o=i.toString(),a=new Set;if(s=s.filter((e=>!a.has(e.text)&&Boolean(a.add(e.text)))),(o||n)&&(s=o?s.concat(this.additionalCompletions(o)):this.additionalCompletions(o).concat(s)),!s.length)return void this.clearAutocomplete();const l=t.getRangeAt(0),h=document.createRange();if(h.setStart(i.startContainer,i.startOffset),h.setEnd(l.endContainer,l.endOffset),o+l.toString()!==h.toString())return;const d=document.createRange();d.setStart(this.element(),0),d.setEnd(h.startContainer,h.startOffset),this.queryRange=new r.TextRange.TextRange(0,d.toString().length,0,d.toString().length+h.toString().length);const c=!this.disableDefaultSuggestionForEmptyInputInternal||Boolean(this.text());this.suggestBox&&this.suggestBox.updateSuggestions(this.boxForAnchorAtStart(t,h),s,c,!this.isCaretAtEndOfPrompt(),this.text())}applySuggestion(e,t){this.currentSuggestion=e,this.refreshGhostText(),t&&this.dispatchEventToListeners(xn.TextChanged)}acceptSuggestion(){this.acceptSuggestionInternal()}acceptSuggestionInternal(){if(!this.queryRange)return!1;const e=this.currentSuggestion?this.currentSuggestion.text.length:0,t=this.currentSuggestion?this.currentSuggestion.selectionRange:null,i=t?t.endColumn:e,n=t?t.startColumn:e;return this.element().textContent=this.textWithCurrentSuggestion(),this.setDOMSelection(this.queryRange.startColumn+n,this.queryRange.startColumn+i),this.updateLeftParenthesesIndices(),this.clearAutocomplete(),this.dispatchEventToListeners(xn.TextChanged),!0}ariaControlledBy(){return this.element()}setDOMSelection(e,t){this.element().normalize();const i=this.element().childNodes[0];if(!i||i===this.ghostTextElement)return;const n=document.createRange();n.setStart(i,e),n.setEnd(i,t);const s=this.element().getComponentSelection();s&&(s.removeAllRanges(),s.addRange(n))}isSuggestBoxVisible(){return void 0!==this.suggestBox&&this.suggestBox.visible()}isCaretInsidePrompt(){const e=this.element().getComponentSelection();if(!e||0===e.rangeCount||!e.isCollapsed)return!1;return e.getRangeAt(0).startContainer.isSelfOrDescendant(this.element())}isCaretAtEndOfPrompt(){const e=this.element().getComponentSelection();if(!e||0===e.rangeCount||!e.isCollapsed)return!1;const t=e.getRangeAt(0);let i=t.startContainer;if(!i.isSelfOrDescendant(this.element()))return!1;if(this.ghostTextElement.isAncestor(i))return!0;if(i.nodeType===Node.TEXT_NODE&&t.startOffset<(i.nodeValue||"").length)return!1;let n=!1;for(;i;){if(i.nodeType===Node.TEXT_NODE&&i.nodeValue&&i.nodeValue.length){if(n&&!this.ghostTextElement.isAncestor(i))return!1;n=!0}i=i.traverseNextNode(this.elementInternal)}return!0}moveCaretToEndOfPrompt(){const e=this.element().getComponentSelection(),t=document.createRange();let i=this.element();for(;i.lastChild;)i=i.lastChild;let n=0;if(i.nodeType===Node.TEXT_NODE){n=(i.textContent||"").length}t.setStart(i,n),t.setEnd(i,n),e&&(e.removeAllRanges(),e.addRange(t))}getCaretPosition(){if(!this.element().hasFocus())return-1;const e=this.element().getComponentSelection();if(!e||0===e.rangeCount||!e.isCollapsed)return-1;const t=e.getRangeAt(0);return t.startOffset!==t.endOffset?-1:t.startOffset}tabKeyPressed(e){return this.acceptAutoComplete()}proxyElementForTests(){return this.proxyElement||null}tryMatchingLeftParenthesis(e){const t=this.leftParenthesesIndices;if(0===t.length||e<0)return!1;for(let i=t.length-1;i>=0;--i)if(t[i]<e)return t.splice(i,1),!0;return!1}updateLeftParenthesesIndices(){const e=this.text(),t=this.leftParenthesesIndices=[];for(let i=0;i<e.length;++i)"("===e[i]&&t.push(i)}suggestBoxForTest(){return this.suggestBox}}const wn=250;var xn;(xn||(xn={})).TextChanged="TextChanged";var En=Object.freeze({__proto__:null,TextPrompt:vn,get Events(){return xn}}),In={cssContent:':host{flex:none;padding:0 2px;--toolbar-height:26px}.toolbar-shadow{position:relative;white-space:nowrap;height:var(--toolbar-height);overflow:hidden;display:flex;flex:none;align-items:center;z-index:0}.toolbar-shadow.wrappable{flex-wrap:wrap;overflow:visible}.toolbar-shadow.toolbar-grow-vertical{height:initial}.toolbar-shadow.vertical{flex-direction:column;height:auto;align-items:flex-start}.toolbar-item{position:relative;display:flex;background-color:transparent;flex:none;align-items:center;justify-content:center;padding:0;height:var(--toolbar-height);border:none;white-space:pre;overflow:hidden}.toolbar-item,\n.toolbar-item .devtools-link{color:var(--icon-default-hover)}.toolbar-shadow.vertical .toolbar-item{height:auto;min-height:var(--toolbar-height);white-space:normal}.toolbar-dropdown-arrow{background-color:var(--color-text-secondary);pointer-events:none;flex:none;margin-left:-4px}.toolbar-button.dark-text .toolbar-dropdown-arrow{background-color:var(--color-text-primary)}select.toolbar-item:disabled + .toolbar-dropdown-arrow{opacity:50%}.toolbar-button{white-space:nowrap;overflow:hidden;min-width:28px;background:transparent;border-radius:0}.toolbar-text{margin:0 5px;flex:none;color:var(--color-text-secondary)}.toolbar-text:empty{margin:0}.toolbar-has-dropdown{justify-content:space-between;padding:0 3px 0 5px;border:1px solid transparent}.toolbar-has-dropdown-shrinkable{flex-shrink:1}.toolbar-has-dropdown .toolbar-text{margin:0 4px 0 0;text-overflow:ellipsis;flex:auto;overflow:hidden;text-align:right}.toolbar-render-as-links *{font-weight:initial;color:var(--color-link);text-decoration:underline;cursor:pointer}.toolbar-render-as-links button{height:15px;margin:2px}.toolbar-render-as-links button:focus-visible{outline:auto 5px -webkit-focus-ring-color}:not(.toolbar-render-as-links) .toolbar-button:focus-visible::before{position:absolute;top:2px;bottom:2px;left:2px;right:2px;background-color:var(--color-background-elevation-2);border-radius:2px;content:"";z-index:-1}.toolbar-icon{--icon-color:var(--color-text-secondary);flex:none}.toolbar-glyph{background-color:var(--color-text-secondary);flex:none}.toolbar-button:disabled{opacity:50%}.toolbar-button.close-devtools{position:absolute;right:0}:host-context(.right) .toolbar-button.main-menu,\n:host-context(.left) .toolbar-button.main-menu,\n:host-context(.bottom) .toolbar-button.main-menu{margin-inline-end:28px}.toolbar-button.copied-to-clipboard::after{content:attr(data-content);position:fixed;margin-top:calc(2 * var(--toolbar-height));padding:3px 5px;color:var(--color-text-secondary);background:var(--color-background-elevation-1);animation:2s fade-out;font-weight:normal;border:1px solid var(--color-details-hairline);border-radius:3px}@keyframes fade-out{from{opacity:100%}to{opacity:0%}}.toolbar-button.toolbar-state-on .toolbar-glyph{background-color:var(--icon-toggled)}.toolbar-button.toolbar-state-on .toolbar-icon{--icon-color:var(--color-primary-old)}.toolbar-state-on.toolbar-toggle-with-dot .toolbar-icon::after,\n.toolbar-state-on.toolbar-toggle-with-dot .toolbar-text::after{content:"";position:absolute;bottom:2px;background-color:var(--color-primary-old);width:4.5px;height:4.5px;border:2px solid var(--override-toolbar-background-color,--color-background);border-radius:50%}.toolbar-state-on.toolbar-toggle-with-dot .toolbar-text::after{right:0}.toolbar-button.toolbar-state-on.toolbar-toggle-with-red-color .toolbar-glyph,\n.toolbar-button.toolbar-state-off.toolbar-default-with-red-color .toolbar-glyph{background-color:var(--icon-error)!important}.toolbar-button.toolbar-state-on.toolbar-toggle-with-red-color .toolbar-icon,\n.toolbar-button.toolbar-state-off.toolbar-default-with-red-color .toolbar-icon{--icon-color:var(--color-accent-red)!important;background-color:var(--color-accent-red)!important}.toolbar-button:not(.toolbar-has-glyph):not(.toolbar-has-dropdown):not(.largeicon-menu):not(.toolbar-button-secondary){font-weight:bold}.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:hover:not(:active){background-color:var(--color-primary-old)}.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:active:hover{background-color:var(--color-primary-old)}.toolbar-toggled-gray:not(.toolbar-render-as-links) .toolbar-button:not(.toolbar-has-glyph):not(.toolbar-has-dropdown):not(.largeicon-menu):hover{background-color:var(--color-background-elevation-1)}.toolbar-button.dark-text .toolbar-text{color:var(--color-text-primary)!important}.toolbar-button.toolbar-state-on .toolbar-text{color:var(--color-primary-old)}:not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-glyph{background-color:var(--color-text-primary)}:not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-icon{--icon-color:var(--color-text-primary)}:not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-text{color:var(--color-text-primary)}.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:hover .toolbar-glyph{background-color:var(--color-background)}.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:hover .toolbar-icon{--icon-color:var(--color-background)}.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:hover .toolbar-text{color:var(--color-text-primary)}.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-glyph{background-color:var(--color-primary-old)}.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-icon{--icon-color:var(--color-primary-old)}.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-text{color:var(--color-text-primary)}.toolbar-toggled-gray .toolbar-button.toolbar-state-on{background-color:var(--color-background-elevation-1)!important}.toolbar-item.checkbox{padding:0 5px 0 2px}.toolbar-item.checkbox:hover{color:var(--color-text-primary)}.toolbar-select-container{display:inline-flex;flex-shrink:0;margin-right:6px}select.toolbar-item{min-width:38px;appearance:none;border:1px solid transparent;border-radius:0;padding:0 13px 0 5px;margin-right:-10px;position:relative;height:22px;margin-top:2px;margin-bottom:2px}select.toolbar-item:disabled{opacity:50%}button.toolbar-item:focus-visible,\nselect.toolbar-item:focus-visible{background:var(--color-background-elevation-2);border-radius:2px}select.toolbar-item:focus-visible > *{background:var(--color-background)}.toolbar-input{width:120px;height:19px;padding:4px 3px 3px;margin:1px 3px;background-color:var(--color-background);border:1px solid transparent;min-width:35px;box-shadow:var(--legacy-focus-ring-inactive-shadow)}.toolbar-input.focused,\n.toolbar-input:not(.toolbar-input-empty){box-shadow:var(--legacy-focus-ring-active-shadow)}.toolbar-input > input{border:none;flex-grow:1}.toolbar-input-clear-button{opacity:70%;flex-basis:13px;flex-shrink:0;height:16px}.toolbar-input-clear-button > .search-cancel-button{display:block}.toolbar-input-clear-button:hover{opacity:99%}.toolbar-input-empty .toolbar-input-clear-button{display:none}.toolbar-prompt-proxy{flex:1}.toolbar-input-prompt{flex:1;overflow:hidden;white-space:nowrap;cursor:auto;color:var(--color-text-primary)}.toolbar-divider{background-color:var(--color-details-hairline);width:1px;margin:5px 4px;height:16px}.toolbar-spacer{flex:auto}.long-click-glyph{position:absolute;background-color:var(--icon-default);top:2px;left:3px}.toolbar-button.emulate-active{background-color:var(--color-background-elevation-2)}.toolbar-button [is="ui-icon"].chevron-down,\n.toolbar-button [is="ui-icon"].chevron-up{transform:scale(0.8)}.toolbar-shadow.floating{flex-direction:column;height:auto;background-color:var(--color-background);border:1px solid var(--color-details-hairline);margin-top:-1px;width:28px;left:-2px}.toolbar-shadow:not(.floating) .toolbar-item:last-child:not(:first-child){flex-shrink:1;justify-content:left}input[is="history-input"]{margin:0 1px;border:1px solid transparent;line-height:16px;padding:1px;color:var(--color-text-primary)}input[is="history-input"]:hover{box-shadow:var(--legacy-focus-ring-inactive-shadow)}input[is="history-input"]:focus,\ninput[is="history-input"]:not(:placeholder-shown){box-shadow:var(--legacy-focus-ring-active-shadow)}.toolbar-item.highlight::before{content:"";position:absolute;top:2px;left:2px;right:2px;bottom:2px;border-radius:2px;background:var(--color-primary-old);z-index:-1}.toolbar-item.highlight > .title{color:var(--color-button-primary-text)}.toolbar-item.highlight:hover:not(:active) > .title{color:var(--color-button-primary-text-hover)}.toolbar-item.highlight:focus-visible{background:var(--color-primary-variant)}.toolbar-item.highlight > .icon-mask{background:var(--color-button-primary-text)}devtools-icon.leading-issue-icon{margin:0 7px}@media (forced-colors: active){.toolbar-button:disabled{opacity:100%;color:Graytext}.toolbar-item,\n  .toolbar-text{color:ButtonText}.toolbar-button:disabled .toolbar-text{color:Graytext}select.toolbar-item:disabled,\n  select.toolbar-item:disabled + .toolbar-dropdown-arrow{opacity:100%;background-color:Graytext}.toolbar-button.toolbar-state-on .toolbar-glyph{forced-color-adjust:none;background-color:Highlight}.toolbar-button.toolbar-state-on .toolbar-icon{--icon-color:Highlight;forced-color-adjust:none}.toolbar-button.toolbar-state-on .toolbar-text{forced-color-adjust:none;color:Highlight}:not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-text,\n  :not(.toolbar-render-as-links) .toolbar-button:enabled:focus:not(:active) .toolbar-text{color:HighlightText}.toolbar-button:disabled [is="ui-icon"].icon-mask{background-color:GrayText;color:GrayText}:not(.toolbar-render-as-links) .toolbar-button:disabled .toolbar-glyph{background-color:GrayText;color:GrayText}:not(.toolbar-render-as-links) .toolbar-button:disabled .toolbar-icon{--icon-color:GrayText;color:GrayText}.toolbar-button:enabled.hover:not(:active) .toolbar-glyph,\n  .toolbar-button:focus,\n  .toolbar-button:hover:enabled,\n  .toolbar-toggled-gray:not(.toolbar-render-as-links) .toolbar-button:not(.toolbar-has-glyph):not(.toolbar-has-dropdown):not(.largeicon-menu):hover{forced-color-adjust:none;background-color:Highlight}.toolbar-button:enabled:hover .toolbar-icon,\n  .toolbar-button:enabled:focus .toolbar-icon,\n  :not(.toolbar-render-as-links) .toolbar-button:enabled:hover .toolbar-icon,\n  :not(.toolbar-render-as-links) .toolbar-button:enabled:focus .toolbar-icon,\n  :not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-icon{--icon-color:HighlightText}:not(.toolbar-render-as-links) .toolbar-button:enabled:hover .toolbar-glyph,\n  :not(.toolbar-render-as-links) .toolbar-button:enabled:focus .toolbar-glyph,\n  :not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-glyph,\n  .toolbar-button:enabled:hover [is="ui-icon"].icon-mask,\n  .toolbar-button:enabled:focus [is="ui-icon"].icon-mask{background-color:HighlightText}.toolbar-input{forced-color-adjust:none;background:canvas;box-shadow:var(--legacy-focus-ring-inactive-shadow)}.toolbar-input.focused,\n  .toolbar-input:not(.toolbar-input-empty){forced-color-adjust:none;background:canvas;box-shadow:var(--legacy-focus-ring-active-shadow)}.toolbar-input:hover{box-shadow:var(--legacy-focus-ring-active-shadow)}.toolbar-item .devtools-link{color:linktext}.toolbar-has-dropdown{forced-color-adjust:none;background:ButtonFace;color:ButtonText}}'};const Sn={pressed:"pressed",notPressed:"not pressed",clearInput:"Clear input"},yn=t.i18n.registerUIStrings("ui/legacy/Toolbar.ts",Sn),Cn=t.i18n.getLocalizedString.bind(void 0,yn);class kn{items;element;enabled;shadowRoot;contentElement;compactLayout=!1;constructor(e,t){this.items=[],this.element=t?t.createChild("div"):document.createElement("div"),this.element.className=e,this.element.classList.add("toolbar"),this.enabled=!0,this.shadowRoot=o.createShadowRootWithCoreStyles(this.element,{cssFile:In,delegatesFocus:void 0}),this.contentElement=this.shadowRoot.createChild("div","toolbar-shadow")}hasCompactLayout(){return this.compactLayout}registerCSSFiles(e){this.shadowRoot.adoptedStyleSheets=this.shadowRoot.adoptedStyleSheets.concat(e)}setCompactLayout(e){if(this.compactLayout!==e){this.compactLayout=e;for(const t of this.items)t.setCompactLayout(e)}}static createLongPressActionButton(e,t,i){const n=kn.createActionButton(e),s=kn.createActionButton(e);let o=null,r=null,a=null;return e.addEventListener("Toggled",l),l(),n;function l(){const s=e.toggled()?t||null:i||null;s&&s.length?o||(o=new ws(n.element,h),a=Pe.create("triangle-bottom-right","long-click-glyph"),n.element.appendChild(a),r=s):o&&(o.dispose(),o=null,a&&a.remove(),a=null,r=null)}function h(){let e=r?r.slice():[];e.push(s);const t=n.element.ownerDocument;t.documentElement.addEventListener("mouseup",(function n(s){if(1!==s.which)return;i.hide(),t.documentElement.removeEventListener("mouseup",n,!1);for(let t=0;t<e.length;++t)if(e[t].element.classList.contains("emulate-active")){e[t].element.classList.remove("emulate-active"),e[t].clicked(s);break}}),!1);const i=new Ks;i.setPointerEventsBehavior("BlockedByGlassPane"),i.show(t);const o=new kn("fill",i.contentElement);o.contentElement.classList.add("floating");const a=n.element.boxInWindow().relativeToElement(Ks.container(t)),l=a.y+26*e.length<t.documentElement.offsetHeight;l&&(e=e.reverse()),o.element.style.height=26*e.length+"px",o.element.style.top=l?a.y-5+"px":a.y-26*(e.length-1)-6+"px",o.element.style.left=a.x-5+"px";for(let t=0;t<e.length;++t)e[t].element.addEventListener("mousemove",d,!1),e[t].element.addEventListener("mouseout",c,!1),o.appendToolbarItem(e[t]);const h=l?0:e.length-1;function d(e){if(1===e.which&&e.target instanceof HTMLElement){e.target.enclosingNodeOrSelfWithClass("toolbar-item").classList.add("emulate-active")}}function c(e){if(1===e.which&&e.target instanceof HTMLElement){e.target.enclosingNodeOrSelfWithClass("toolbar-item").classList.remove("emulate-active")}}e[h].element.classList.add("emulate-active")}}static createActionButton(e,t=Tn){const i=e.toggleable()?function(){const t=new Rn(e.title(),e.icon(),e.toggledIcon());return t.setToggleWithRedColor(e.toggleWithRedColor()),e.addEventListener("Toggled",i),i(),t;function i(){t.setToggled(e.toggled()),e.title()&&(t.setTitle(e.title()),ii.installWithActionBinding(t.element,e.title(),e.id()))}}():function(){const t=new Pn(e.title(),e.icon());e.title()&&ii.installWithActionBinding(t.element,e.title(),e.id());return t}();t.showLabel&&i.setText(e.title());let n=t=>{e.execute()};if(t.userActionCode){const i=t.userActionCode;n=()=>{s.userMetrics.actionTaken(i),e.execute()}}return i.addEventListener(Pn.Events.Click,n,e),e.addEventListener("Enabled",(function(e){i.setEnabled(e.data)})),i.setEnabled(e.enabled()),i}static createActionButtonForId(e,t=Tn){const i=L.instance().action(e);return kn.createActionButton(i,t)}gripElementForResize(){return this.contentElement}makeWrappable(e){this.contentElement.classList.add("wrappable"),e&&this.contentElement.classList.add("toolbar-grow-vertical")}makeVertical(){this.contentElement.classList.add("vertical")}makeBlueOnHover(){this.contentElement.classList.add("toolbar-blue-on-hover")}makeToggledGray(){this.contentElement.classList.add("toolbar-toggled-gray")}renderAsLinks(){this.contentElement.classList.add("toolbar-render-as-links")}empty(){return!this.items.length}setEnabled(e){this.enabled=e;for(const e of this.items)e.applyEnabledState(this.enabled&&e.enabled)}appendToolbarItem(e){this.items.push(e),e.toolbar=this,e.setCompactLayout(this.hasCompactLayout()),this.enabled||e.applyEnabledState(!1),this.contentElement.appendChild(e.element),this.hideSeparatorDupes()}appendSeparator(){this.appendToolbarItem(new Bn)}appendSpacer(){this.appendToolbarItem(new Bn(!0))}appendText(e){this.appendToolbarItem(new Ln(e))}removeToolbarItem(e){const t=[];for(const i of this.items)i===e?i.element.remove():t.push(i);this.items=t}removeToolbarItems(){for(const e of this.items)e.toolbar=null;this.items=[],this.contentElement.removeChildren()}setColor(e){const t=document.createElement("style");t.textContent=".toolbar-glyph { background-color: "+e+" !important }",this.shadowRoot.appendChild(t)}setToggledColor(e){const t=document.createElement("style");t.textContent=".toolbar-button.toolbar-state-on .toolbar-glyph { background-color: "+e+" !important }",this.shadowRoot.appendChild(t)}hideSeparatorDupes(){if(!this.items.length)return;let e,t=!1,i=!1;for(let n=0;n<this.items.length;++n)this.items[n]instanceof Bn?(this.items[n].setVisible(!t),t=!0,e=this.items[n]):this.items[n].visible()&&(t=!1,e=null,i=!0);e&&e!==this.items[this.items.length-1]&&e.setVisible(!1),this.element.classList.toggle("hidden",null!=e&&e.visible()&&!i)}async appendItemsAtLocation(e){const t=Hn.filter((e=>i.Runtime.Runtime.isDescriptorEnabled({experiment:e.experiment,condition:e.condition})));t.sort(((e,t)=>(e.order||0)-(t.order||0)));const n=t.filter((t=>t.location===e)),s=await Promise.all(n.map((e=>{const{separator:t,actionId:i,showLabel:n,loadItem:s}=e;if(t)return new Bn;if(i)return kn.createActionButtonForId(i,{showLabel:Boolean(n),userActionCode:void 0});if(!s)throw new Error("Could not load a toolbar item registration with no loadItem function");return s().then((e=>e.item()))})));for(const e of s)e&&this.appendToolbarItem(e)}}const Tn={showLabel:!1,userActionCode:void 0};class Mn extends e.ObjectWrapper.ObjectWrapper{element;visibleInternal;enabled;toolbar;title;constructor(e){super(),this.element=e,this.element.classList.add("toolbar-item"),this.visibleInternal=!0,this.enabled=!0,this.toolbar=null}setTitle(e,t){this.title!==e&&(this.title=e,be(this.element,e),void 0===t?ii.install(this.element,e):ii.installWithActionBinding(this.element,e,t))}setEnabled(e){this.enabled!==e&&(this.enabled=e,this.applyEnabledState(this.enabled&&(!this.toolbar||this.toolbar.enabled)))}applyEnabledState(e){this.element.disabled=!e}visible(){return this.visibleInternal}setVisible(e){this.visibleInternal!==e&&(this.element.classList.toggle("hidden",!e),this.visibleInternal=e,!this.toolbar||this instanceof Bn||this.toolbar.hideSeparatorDupes())}setRightAligned(e){this.element.classList.toggle("toolbar-item-right-aligned",e)}setCompactLayout(e){}}class Ln extends Mn{constructor(e){const t=document.createElement("div");t.classList.add("toolbar-text"),super(t),this.element.classList.add("toolbar-text"),this.setText(e||"")}text(){return this.element.textContent||""}setText(e){this.element.textContent=e}}class Pn extends Mn{glyphElement;textElement;text;glyph;icon;constructor(e,t,i){const n=document.createElement("button");n.classList.add("toolbar-button"),super(n),this.element.addEventListener("click",this.clicked.bind(this),!1),this.element.addEventListener("mousedown",this.mouseDown.bind(this),!1),this.glyphElement=Pe.create("","toolbar-glyph hidden"),this.element.appendChild(this.glyphElement),this.textElement=this.element.createChild("div","toolbar-text hidden"),this.setTitle(e),t&&this.setGlyphOrIcon(t),this.setText(i||""),this.title=""}focus(){this.element.focus()}setText(e){this.text!==e&&(this.textElement.textContent=e,this.textElement.classList.toggle("hidden",!e),this.text=e)}setGlyphOrIcon(e){e instanceof HTMLElement?(e.classList.add("toolbar-icon"),this.icon?this.icon.replaceWith(e):this.element.appendChild(e),this.icon=e):e&&this.setGlyph(e)}setGlyph(e){this.glyph!==e&&(this.glyphElement.setIconType(e),this.glyphElement.classList.toggle("hidden",!e),this.element.classList.toggle("toolbar-has-glyph",Boolean(e)),this.glyph=e)}setBackgroundImage(e){this.element.style.backgroundImage="url("+e+")"}setSecondary(){this.element.classList.add("toolbar-button-secondary")}setDarkText(){this.element.classList.add("dark-text")}turnIntoSelect(e=!1){this.element.classList.add("toolbar-has-dropdown"),e&&this.element.classList.add("toolbar-has-dropdown-shrinkable");const t=Pe.create("triangle-down","toolbar-dropdown-arrow");this.element.appendChild(t)}clicked(e){this.enabled&&(this.dispatchEventToListeners(Pn.Events.Click,e),e.consume())}mouseDown(e){this.enabled&&this.dispatchEventToListeners(Pn.Events.MouseDown,e)}}!function(e){let t;!function(e){e.Click="Click",e.MouseDown="MouseDown"}(t=e.Events||(e.Events={}))}(Pn||(Pn={}));class Dn extends Mn{prompt;proxyElement;constructor(e,t,i,n,s,o,r){const l=document.createElement("div");l.classList.add("toolbar-input"),super(l);const h=this.element.createChild("div","toolbar-input-prompt");be(h,e),h.addEventListener("focus",(()=>this.element.classList.add("focused"))),h.addEventListener("blur",(()=>this.element.classList.remove("focused"))),this.prompt=new vn,this.proxyElement=this.prompt.attach(h),this.proxyElement.classList.add("toolbar-prompt-proxy"),this.proxyElement.addEventListener("keydown",(e=>this.onKeydownCallback(e))),this.prompt.initialize(o||(()=>Promise.resolve([]))," ",r),s&&this.prompt.setTitle(s),this.prompt.setPlaceholder(e,t),this.prompt.addEventListener(xn.TextChanged,this.onChangeCallback.bind(this)),i&&(this.element.style.flexGrow=String(i)),n&&(this.element.style.flexShrink=String(n));const d=this.element.createChild("div","toolbar-input-clear-button");d.title=Sn.clearInput;const c=new a.Icon.Icon;c.data={color:"var(--icon-default)",width:"16px",height:"16px",iconName:"cross-circle-filled"},c.classList.add("search-cancel-button"),d.appendChild(c),d.addEventListener("click",(()=>{this.setValue("",!0),this.prompt.focus()})),this.updateEmptyStyles()}applyEnabledState(e){this.prompt.setEnabled(e)}setValue(e,t){this.prompt.setText(e),t&&this.onChangeCallback(),this.updateEmptyStyles()}value(){return this.prompt.textWithCurrentSuggestion()}valueWithoutSuggestion(){return this.prompt.text()}onKeydownCallback(e){"Enter"===e.key&&this.prompt.text()&&this.dispatchEventToListeners(Dn.Event.EnterPressed,this.prompt.text()),n.KeyboardUtilities.isEscKey(e)&&this.prompt.text()&&(this.setValue("",!0),e.consume(!0))}onChangeCallback(){this.updateEmptyStyles(),this.dispatchEventToListeners(Dn.Event.TextChanged,this.prompt.text())}updateEmptyStyles(){this.element.classList.toggle("toolbar-input-empty",!this.prompt.text())}}!function(e){let t;!function(e){e.TextChanged="TextChanged",e.EnterPressed="EnterPressed"}(t=e.Event||(e.Event={}))}(Dn||(Dn={}));class Rn extends Pn{toggledInternal;untoggledGlyphOrIcon;toggledGlyphOrIcon;constructor(e,t,i){super(e,t,""),this.toggledInternal=!1,this.untoggledGlyphOrIcon=t,this.toggledGlyphOrIcon=i,this.element.classList.add("toolbar-state-off"),ge(this.element,!1)}toggled(){return this.toggledInternal}setToggled(e){this.toggledInternal!==e&&(this.toggledInternal=e,this.element.classList.toggle("toolbar-state-on",e),this.element.classList.toggle("toolbar-state-off",!e),ge(this.element,e),this.toggledGlyphOrIcon&&this.untoggledGlyphOrIcon&&this.setGlyphOrIcon(e?this.toggledGlyphOrIcon:this.untoggledGlyphOrIcon))}setDefaultWithRedColor(e){this.element.classList.toggle("toolbar-default-with-red-color",e)}setToggleWithRedColor(e){this.element.classList.toggle("toolbar-toggle-with-red-color",e)}setToggleWithDot(e){this.element.classList.toggle("toolbar-toggle-with-dot",e)}}class An extends Pn{contextMenuHandler;useSoftMenu;triggerTimeout;lastTriggerTime;constructor(e,t){super("","dots-vertical"),this.contextMenuHandler=e,this.useSoftMenu=Boolean(t),z(this.element)}mouseDown(e){1===e.buttons?this.triggerTimeout||(this.triggerTimeout=window.setTimeout(this.trigger.bind(this,e),200)):super.mouseDown(e)}trigger(e){if(delete this.triggerTimeout,this.lastTriggerTime&&Date.now()-this.lastTriggerTime<300)return;const t=new fo(e,{useSoftMenu:this.useSoftMenu,x:this.element.getBoundingClientRect().left,y:this.element.getBoundingClientRect().top+this.element.offsetHeight});this.contextMenuHandler(t),t.show(),this.lastTriggerTime=Date.now()}clicked(e){this.triggerTimeout&&clearTimeout(this.triggerTimeout),this.trigger(e)}}class On extends Rn{defaultTitle;setting;willAnnounceState;constructor(e,t,i,n){super(i,t,n),this.defaultTitle=i,this.setting=e,this.settingChanged(),this.setting.addChangeListener(this.settingChanged,this),this.willAnnounceState=!1}settingChanged(){const e=this.setting.get();this.setToggled(e);const t=Cn(e?Sn.pressed:Sn.notPressed);this.willAnnounceState&&ke(t),this.willAnnounceState=!1,this.setTitle(this.defaultTitle)}clicked(e){this.willAnnounceState=!0,this.setting.set(!this.toggled()),super.clicked(e)}}class Bn extends Mn{constructor(e){const t=document.createElement("div");t.classList.add(e?"toolbar-spacer":"toolbar-divider"),super(t)}}class Wn extends Mn{selectElementInternal;constructor(e,t,i){const n=document.createElement("span");n.classList.add("toolbar-select-container"),super(n),this.selectElementInternal=this.element.createChild("select","toolbar-item");const s=Pe.create("triangle-down","toolbar-dropdown-arrow");this.element.appendChild(s),e&&this.selectElementInternal.addEventListener("change",e,!1),be(this.selectElementInternal,t),super.setTitle(t),i&&this.selectElementInternal.classList.add(i)}selectElement(){return this.selectElementInternal}size(){return this.selectElementInternal.childElementCount}options(){return Array.prototype.slice.call(this.selectElementInternal.children,0)}addOption(e){this.selectElementInternal.appendChild(e)}createOption(e,t){const i=this.selectElementInternal.createChild("option");return i.text=e,void 0!==t&&(i.value=t),i}applyEnabledState(e){super.applyEnabledState(e),this.selectElementInternal.disabled=!e}removeOption(e){this.selectElementInternal.removeChild(e)}removeOptions(){this.selectElementInternal.removeChildren()}selectedOption(){return this.selectElementInternal.selectedIndex>=0?this.selectElementInternal[this.selectElementInternal.selectedIndex]:null}select(e){this.selectElementInternal.selectedIndex=Array.prototype.indexOf.call(this.selectElementInternal,e)}setSelectedIndex(e){this.selectElementInternal.selectedIndex=e}selectedIndex(){return this.selectElementInternal.selectedIndex}setMaxWidth(e){this.selectElementInternal.style.maxWidth=e+"px"}setMinWidth(e){this.selectElementInternal.style.minWidth=e+"px"}}class Fn extends Mn{inputElement;constructor(e,t,i){super(ys.create(e)),this.element.classList.add("checkbox"),this.inputElement=this.element.checkboxElement,t&&(ii.install(this.inputElement,t),ii.install(this.element.textElement,t)),i&&this.inputElement.addEventListener("click",i,!1)}checked(){return this.inputElement.checked}setChecked(e){this.inputElement.checked=e}applyEnabledState(e){super.applyEnabledState(e),this.inputElement.disabled=!e}setIndeterminate(e){this.inputElement.indeterminate=e}}const Hn=[];var zn;!function(e){e.FILES_NAVIGATION_TOOLBAR="files-navigator-toolbar",e.MAIN_TOOLBAR_RIGHT="main-toolbar-right",e.MAIN_TOOLBAR_LEFT="main-toolbar-left",e.STYLES_SIDEBARPANE_TOOLBAR="styles-sidebarpane-toolbar"}(zn||(zn={}));var Nn=Object.freeze({__proto__:null,Toolbar:kn,ToolbarItem:Mn,ToolbarItemWithCompactLayout:class extends Mn{constructor(e){super(e)}setCompactLayout(e){this.dispatchEventToListeners("CompactLayoutUpdated",e)}},ToolbarText:Ln,get ToolbarButton(){return Pn},get ToolbarInput(){return Dn},ToolbarToggle:Rn,ToolbarMenuButton:An,ToolbarSettingToggle:On,ToolbarSeparator:Bn,ToolbarComboBox:Wn,ToolbarSettingComboBox:class extends Wn{optionsInternal;setting;muteSettingListener;constructor(e,t,i){super(null,i),this.optionsInternal=e,this.setting=t,this.selectElementInternal.addEventListener("change",this.valueChanged.bind(this),!1),this.setOptions(e),t.addChangeListener(this.settingChanged,this)}setOptions(e){this.optionsInternal=e,this.selectElementInternal.removeChildren();for(let t=0;t<e.length;++t){const i=e[t],n=this.createOption(i.label,i.value);this.selectElementInternal.appendChild(n),this.setting.get()===i.value&&this.setSelectedIndex(t)}}value(){return this.optionsInternal[this.selectedIndex()].value}settingChanged(){if(this.muteSettingListener)return;const e=this.setting.get();for(let t=0;t<this.optionsInternal.length;++t)if(e===this.optionsInternal[t].value){this.setSelectedIndex(t);break}}valueChanged(e){const t=this.optionsInternal[this.selectedIndex()];this.muteSettingListener=!0,this.setting.set(t.value),this.muteSettingListener=!1}},ToolbarCheckbox:Fn,ToolbarSettingCheckbox:class extends Fn{constructor(e,t,i){super(i||e.title()||"",t),nn(this.inputElement,e)}},registerToolbarItem:function(e){Hn.push(e)},get ToolbarItemLocation(){return zn}}),_n={cssContent:":host{padding:0;margin:0;display:inline-flex;flex-shrink:0;align-items:center!important}input{height:12px;width:12px;flex-shrink:0}input.inside-datagrid{height:10px;width:10px}input:focus{outline:auto 5px -webkit-focus-ring-color}:host-context(.-theme-with-dark-background) input{accent-color:var(--color-checkbox-accent-color)}.dt-checkbox-text{margin-left:3px;overflow:hidden;text-overflow:ellipsis}.dt-checkbox-subtitle{color:var(--color-text-secondary)}@media (forced-colors: active){input.dt-checkbox-theme-preserve{forced-color-adjust:none}input.dt-checkbox-theme-preserve:active{background:HighlightText}input.dt-checkbox-theme-preserve:checked,\n  input.dt-checkbox-theme-preserve:active:checked{background:Highlight;border-color:Highlight}input.dt-checkbox-theme-preserve:hover:enabled{border-color:Highlight}input.dt-checkbox-theme-preserve:active::before,\n  input.dt-checkbox-theme-preserve:active::after{background-color:Highlight}input.dt-checkbox-theme-preserve:checked::before,\n  input.dt-checkbox-theme-preserve:checked::after,\n  input.dt-checkbox-theme-preserve:active:checked::before,\n  input.dt-checkbox-theme-preserve:active:checked::after{background-color:HighlightText}input.dt-checkbox-theme-preserve:hover:checked::before,\n  input.dt-checkbox-theme-preserve:hover:checked::after{background-color:Highlight!important}input.dt-checkbox-theme-preserve:hover:checked{background:HighlightText}}"},Vn={cssContent:".close-button{width:20px;height:20px;display:flex;align-items:center;justify-content:center}.close-button:hover .cross,\n.close-button:focus-visible .cross{background-color:var(--icon-default-hover)}.close-button:active .cross{background-color:var(--icon-default)}@media (forced-colors: active) and (prefers-color-scheme: dark){.close-button{filter:brightness(100)}}"},Un={cssContent:".widget{padding:20px}.message,\n.button{font-size:larger;white-space:pre;margin:5px}.button{text-align:center;margin-top:10px}.button button{min-width:80px}.reason{color:var(--color-accent-red)}"},Kn={cssContent:":host{display:inline-flex;border:1px solid var(--color-details-hairline);position:relative;top:7px;margin:2px;background-color:var(--color-background-elevation-1);justify-content:center;width:28px}"},jn={cssContent:"::slotted(input.dt-radio-button){height:17px;width:17px;min-width:17px;border-radius:8px;vertical-align:middle;margin:0 5px 5px 0;accent-color:var(--color-checkbox-accent-color)}::slotted(input.dt-radio-button:focus){box-shadow:var(--legacy-focus-ring-active-shadow)}@media (forced-colors: active){::slotted(input.dt-radio-button){--gradient-start:ButtonFace;--gradient-end:ButtonFace}::slotted(input.dt-radio-button:checked){--gradient-start:Highlight;--gradient-end:Highlight}}"},qn={cssContent:".dt-range-input{appearance:none;margin:0;padding:0;height:10px;width:88px;outline:none;background:none}.dt-range-input::-webkit-slider-thumb,\n.-theme-preserve{appearance:none;margin:0;padding:0;border:0;width:12px;height:12px;margin-top:-5px;border-radius:50%;background-color:var(--color-primary-old)}.dt-range-input::-webkit-slider-runnable-track{appearance:none;margin:0;padding:0;width:100%;height:2px;background-color:var(--color-background-elevation-2)}.dt-range-input:focus::-webkit-slider-thumb{box-shadow:0 0 0 2px var(--color-primary-variant)}.dt-range-input:disabled::-webkit-slider-thumb{background-color:var(--color-text-disabled)}@media (forced-colors: active){.dt-range-input{forced-color-adjust:none}}"},Gn={cssContent:"div{display:inline-flex;height:14px;align-items:center;vertical-align:middle;white-space:nowrap;padding:1px 4px;text-align:left;font-size:11px;line-height:normal;font-weight:bold;text-shadow:none;color:var(--color-background);border-radius:7px}div.verbose{background-color:var(--color-syntax-3)}:host-context(.-theme-with-dark-background) div.verbose{background-color:var(--color-syntax-2)}div.info{background-color:var(--color-syntax-8)}div.warning{background-color:var(--color-syntax-4)}:host-context(.-theme-with-dark-background) div.warning{background-color:var(--color-syntax-3)}div.error{background-color:var(--color-accent-red)}"};const Xn={openInNewTab:"Open in new tab",copyLinkAddress:"Copy link address",copyFileName:"Copy file name",anotherProfilerIsAlreadyActive:"Another profiler is already active",promiseResolvedAsync:"Promise resolved (async)",promiseRejectedAsync:"Promise rejected (async)",sAsync:"{PH1} (async)",asyncCall:"Async Call",anonymous:"(anonymous)",close:"Close",ok:"OK",cancel:"Cancel"},Yn=t.i18n.registerUIStrings("ui/legacy/UIUtils.ts",Xn),$n=t.i18n.getLocalizedString.bind(void 0,Yn);function Qn(e,t,i,n,s,o,r){let a;e.addEventListener("pointerdown",(function(o){const l=new Jn,h=()=>l.elementDragStart(e,t,i,n,s,o);r?a=window.setTimeout(h,r):h()}),!1),r&&e.addEventListener("pointerup",(function(){a&&window.clearTimeout(a),a=null}),!1),null!==o&&(e.style.cursor=o||s||"")}function Zn(e,t,i,n,s,o){(new Jn).elementDragStart(e,t,i,n,s,o)}class Jn{glassPaneInUse;elementDraggingEventListener;elementEndDraggingEventListener;dragEventsTargetDocument;dragEventsTargetDocumentTop;restoreCursorAfterDrag;constructor(){this.elementDragMove=this.elementDragMove.bind(this),this.elementDragEnd=this.elementDragEnd.bind(this),this.mouseOutWhileDragging=this.mouseOutWhileDragging.bind(this)}createGlassPane(){this.glassPaneInUse=!0,Jn.glassPaneUsageCount++||(Jn.glassPane=new Ks,Jn.glassPane.setPointerEventsBehavior("BlockedByGlassPane"),Jn.documentForMouseOut&&Jn.glassPane.show(Jn.documentForMouseOut))}disposeGlassPane(){this.glassPaneInUse&&(this.glassPaneInUse=!1,--Jn.glassPaneUsageCount||(Jn.glassPane&&(Jn.glassPane.hide(),Jn.glassPane=null),Jn.documentForMouseOut=null,Jn.rootForMouseOut=null))}elementDragStart(e,t,i,n,o,r){const a=r;if(a.button||s.Platform.isMac()&&a.ctrlKey)return;if(this.elementDraggingEventListener)return;if(t&&!t(a))return;const l=a.target instanceof Node&&a.target.ownerDocument;this.elementDraggingEventListener=i,this.elementEndDraggingEventListener=n,console.assert((Jn.documentForMouseOut||l)===l,"Dragging on multiple documents."),Jn.documentForMouseOut=l,Jn.rootForMouseOut=a.target instanceof Node&&a.target.getRootNode()||null,this.dragEventsTargetDocument=l;try{l.defaultView&&l.defaultView.top&&(this.dragEventsTargetDocumentTop=l.defaultView.top.document)}catch(e){this.dragEventsTargetDocumentTop=this.dragEventsTargetDocument}l.addEventListener("pointermove",this.elementDragMove,!0),l.addEventListener("pointerup",this.elementDragEnd,!0),Jn.rootForMouseOut&&Jn.rootForMouseOut.addEventListener("pointerout",this.mouseOutWhileDragging,{capture:!0}),this.dragEventsTargetDocumentTop&&l!==this.dragEventsTargetDocumentTop&&this.dragEventsTargetDocumentTop.addEventListener("pointerup",this.elementDragEnd,!0);const h=e;"string"==typeof o&&(this.restoreCursorAfterDrag=function(e){l.body.style.removeProperty("cursor"),h.style.cursor=e,this.restoreCursorAfterDrag=void 0}.bind(this,h.style.cursor),h.style.cursor=o,l.body.style.cursor=o),a.preventDefault()}mouseOutWhileDragging(){this.unregisterMouseOutWhileDragging(),this.createGlassPane()}unregisterMouseOutWhileDragging(){Jn.rootForMouseOut&&Jn.rootForMouseOut.removeEventListener("pointerout",this.mouseOutWhileDragging,{capture:!0})}unregisterDragEvents(){this.dragEventsTargetDocument&&(this.dragEventsTargetDocument.removeEventListener("pointermove",this.elementDragMove,!0),this.dragEventsTargetDocument.removeEventListener("pointerup",this.elementDragEnd,!0),this.dragEventsTargetDocumentTop&&this.dragEventsTargetDocument!==this.dragEventsTargetDocumentTop&&this.dragEventsTargetDocumentTop.removeEventListener("pointerup",this.elementDragEnd,!0),delete this.dragEventsTargetDocument,delete this.dragEventsTargetDocumentTop)}elementDragMove(e){1===e.buttons?this.elementDraggingEventListener&&this.elementDraggingEventListener(e)&&this.cancelDragEvents(e):this.elementDragEnd(e)}cancelDragEvents(e){this.unregisterDragEvents(),this.unregisterMouseOutWhileDragging(),this.restoreCursorAfterDrag&&this.restoreCursorAfterDrag(),this.disposeGlassPane(),delete this.elementDraggingEventListener,delete this.elementEndDraggingEventListener}elementDragEnd(e){const t=this.elementEndDraggingEventListener;this.cancelDragEvents(e),e.preventDefault(),t&&t(e)}static glassPaneUsageCount=0;static glassPane=null;static documentForMouseOut=null;static rootForMouseOut=null}function es(){if(is.size)return!0;const e=n.DOMUtilities.deepActiveElement(document);return!!e&&(e.classList.contains("text-prompt")||"INPUT"===e.nodeName||"TEXTAREA"===e.nodeName||"true"===e.contentEditable||"plaintext-only"===e.contentEditable)}function ts(e,t){if(t){if(is.has(e))return!1;e.classList.add("being-edited"),is.add(e)}else{if(!is.has(e))return!1;e.classList.remove("being-edited"),is.delete(e)}return!0}const is=new Set,ns=/^(-?(?:\d+(?:\.\d+)?|\.\d+))$/;function ss(e){let t=null;if("wheel"===e.type){const i=e;i.deltaY<0||i.deltaX<0?t="Up":(i.deltaY>0||i.deltaX>0)&&(t="Down")}else{const i=e;"ArrowUp"===i.key||"PageUp"===i.key?t="Up":"ArrowDown"!==i.key&&"PageDown"!==i.key||(t="Down")}return t}function os(e,t,i){const n=ss(t);if(!n)return null;const s=t;let o=1;Ge.eventHasCtrlEquivalentKey(s)?o=100:s.shiftKey?o=10:s.altKey&&(o=.1),"Down"===n&&(o*=-1),i&&(o*=i);const r=Number((e+o).toFixed(6));return String(r).match(ns)?r:null}function rs(e,t,i){let s,o,r,a=null,l=/(.*#)([\da-fA-F]+)(.*)/.exec(e);return l&&l.length?(s=l[1],o=l[3],r=function(e,t){const i=ss(t);if(!i)return null;const s=t,o=parseInt(e,16);if(isNaN(o)||!isFinite(o))return null;const r=e.length,a=r/3;if(1!==a&&2!==a)return null;let l=0;Ge.eventHasCtrlEquivalentKey(s)&&(l+=Math.pow(16,2*a)),s.shiftKey&&(l+=Math.pow(16,a)),s.altKey&&(l+=1),0===l&&(l=1),"Down"===i&&(l*=-1);const h=Math.pow(16,r)-1;let d=n.NumberUtilities.clamp(o+l,0,h).toString(16).toUpperCase();for(let e=0,t=r-d.length;e<t;++e)d="0"+d;return d}(l[2],t),null!==r&&(a=s+r+o)):(l=/(.*?)(-?(?:\d+(?:\.\d+)?|\.\d+))(.*)/.exec(e),l&&l.length&&(s=l[1],o=l[3],r=os(parseFloat(l[2]),t),null!==r&&(a=i?i(s,r,o):s+r+o))),a}function as(){return $n(Xn.openInNewTab)}function ls(){return $n(Xn.copyLinkAddress)}function hs(e,t){t.target instanceof Window&&t.target.document.nodeType===Node.DOCUMENT_NODE&&e.body.classList.remove("inactive")}function ds(e,t){t.target instanceof Window&&t.target.document.nodeType===Node.DOCUMENT_NODE&&e.body.classList.add("inactive")}class cs{element;previous;constructor(e){this.element=e,this.previous=n.DOMUtilities.deepActiveElement(e.ownerDocument),e.focus()}restore(){this.element&&(this.element.hasFocus()&&this.previous&&this.previous.focus(),this.previous=null,this.element=null)}}function us(e,t,i){return ms(e,t,"highlighted-search-result",i)}function ms(e,t,i,n){n=n||[];const s=[],o=e.childTextNodes(),a=o.map((function(e){return e.textContent})).join(""),l=e.ownerDocument;if(0===o.length)return s;const h=[];let d=0;for(const e of o){const t=new r.TextRange.SourceRange(d,e.textContent?e.textContent.length:0);d=t.offset+t.length,h.push(t)}let c=0;for(let e=0;e<t.length;++e){const r=t[e].offset,d=r+t[e].length;for(;c<o.length&&h[c].offset+h[c].length<=r;)c++;let u=c;for(;u<o.length&&h[u].offset+h[u].length<d;)u++;if(u===o.length)break;const m=l.createElement("span");m.className=i,m.textContent=a.substring(r,d);const p=o[u],g=p.textContent||"";if(p.textContent=g.substring(d-h[u].offset),n.push({node:p,type:"changed",oldText:g,newText:p.textContent,nextSibling:void 0,parent:void 0}),c===u&&p.parentElement){p.parentElement.insertBefore(m,p),n.push({node:m,type:"added",nextSibling:p,parent:p.parentElement,oldText:void 0,newText:void 0}),s.push(m);const e=l.createTextNode(g.substring(0,r-h[c].offset));p.parentElement.insertBefore(e,m),n.push({node:e,type:"added",nextSibling:m,parent:p.parentElement,oldText:void 0,newText:void 0})}else{const e=o[c],t=e.textContent||"",i=e.nextSibling;e.parentElement&&(e.parentElement.insertBefore(m,i),n.push({node:m,type:"added",nextSibling:i||void 0,parent:e.parentElement,oldText:void 0,newText:void 0}),s.push(m)),e.textContent=t.substring(0,r-h[c].offset),n.push({node:e,type:"changed",oldText:t,newText:e.textContent,nextSibling:void 0,parent:void 0});for(let e=c+1;e<u;e++){const t=o[e],i=t.textContent;t.textContent="",n.push({node:t,type:"changed",oldText:i||void 0,newText:t.textContent,nextSibling:void 0,parent:void 0})}}c=u,h[c].offset=d,h[c].length=p.textContent.length}return s}function ps(e,t){const i=e.parentElement,n=e.nextSibling;(t=t||e.ownerDocument.body).appendChild(e),e.positionAt(0,0);const s=e.getBoundingClientRect();return e.positionAt(void 0,void 0),i?i.insertBefore(e,n):e.remove(),new Ke(s.width,s.height)}class gs{handlers;autoInvoke;constructor(e){this.handlers=null,this.autoInvoke=e}add(e,t){this.handlers||(this.handlers=new Map,this.autoInvoke&&this.scheduleInvoke());let i=this.handlers.get(e);i||(i=new Set,this.handlers.set(e,i)),i.add(t)}scheduleInvoke(){this.handlers&&requestAnimationFrame(this.invoke.bind(this))}invoke(){const e=this.handlers;if(this.handlers=null,e)for(const[t,i]of e)for(const e of i)e.call(t)}}let bs=0,fs=null;function vs(e,t){fs||(fs=new gs(!0)),fs.add(e,t)}class ws{element;callback;editKey;longClickData;longClickInterval;constructor(e,t,i=(e=>n.KeyboardUtilities.isEnterOrSpaceKey(e))){this.element=e,this.callback=t,this.editKey=i,this.enable()}reset(){this.longClickInterval&&(clearInterval(this.longClickInterval),delete this.longClickInterval)}enable(){if(this.longClickData)return;const e=function(e){if(this.editKey(e)){const t=this.callback;this.longClickInterval=window.setTimeout(t.bind(null,e),ws.TIME_MS)}}.bind(this),t=function(e){this.editKey(e)&&this.reset()}.bind(this),i=function(e){if(1!==e.which)return;const t=this.callback;this.longClickInterval=window.setTimeout(t.bind(null,e),ws.TIME_MS)}.bind(this),n=function(e){if(1!==e.which)return;this.reset()}.bind(this),s=this.reset.bind(this);this.element.addEventListener("keydown",e,!1),this.element.addEventListener("keyup",t,!1),this.element.addEventListener("pointerdown",i,!1),this.element.addEventListener("pointerout",s,!1),this.element.addEventListener("pointerup",n,!1),this.element.addEventListener("click",s,!0),this.longClickData={mouseUp:n,mouseDown:i,reset:s}}dispose(){this.longClickData&&(this.element.removeEventListener("pointerdown",this.longClickData.mouseDown,!1),this.element.removeEventListener("pointerout",this.longClickData.reset,!1),this.element.removeEventListener("pointerup",this.longClickData.mouseUp,!1),this.element.addEventListener("click",this.longClickData.reset,!0),delete this.longClickData)}static TIME_MS=200}function xs(e){return e||$n(Xn.anonymous)}const Es=(e,t)=>{const i=e.ownerDocument.createTextNode(t);return e.appendChild(i),i};function Is(e,t,i,n,s){const o=document.createElement("button");return i&&(o.className=i),o.textContent=e,o.classList.add("text-button"),n&&o.classList.add("primary-button"),t&&o.addEventListener(s||"click",t),o.type="button",o}function Ss(e,t){const i=document.createElement("input");return e&&(i.className=e),i.spellcheck=!1,i.classList.add("harmony-input"),t&&(i.type=t),i}class ys extends HTMLSpanElement{shadowRootInternal;checkboxElement;textElement;constructor(){super(),ys.lastId=ys.lastId+1;const e="ui-checkbox-label"+ys.lastId;this.shadowRootInternal=o.createShadowRootWithCoreStyles(this,{cssFile:_n,delegatesFocus:void 0}),this.checkboxElement=this.shadowRootInternal.createChild("input"),this.checkboxElement.type="checkbox",this.checkboxElement.setAttribute("id",e),this.textElement=this.shadowRootInternal.createChild("label","dt-checkbox-text"),this.textElement.setAttribute("for",e),this.shadowRootInternal.createChild("slot")}static create(e,t,i){ys.constructorInternal||(ys.constructorInternal=o.registerCustomElement("span","dt-checkbox",ys));const n=ys.constructorInternal();return n.checkboxElement.checked=Boolean(t),void 0!==e&&(n.textElement.textContent=e,n.checkboxElement.title=e,void 0!==i&&(n.textElement.createChild("div","dt-checkbox-subtitle").textContent=i)),n}static lastId=0;static constructorInternal=null}class Cs extends HTMLSpanElement{#i;constructor(){super();const e=o.createShadowRootWithCoreStyles(this,{cssFile:void 0,delegatesFocus:void 0});this.#i=new a.Icon.Icon,this.#i.style.setProperty("margin-right","4px"),e.appendChild(this.#i),e.createChild("slot")}set data(e){this.#i.data=e,"14px"===e.height?this.#i.style.setProperty("margin-bottom","-2px"):"20px"===e.height&&this.#i.style.setProperty("margin-bottom","2px")}}let ks=0;class Ts extends HTMLSpanElement{radioElement;labelElement;constructor(){super(),this.radioElement=this.createChild("input","dt-radio-button"),this.labelElement=this.createChild("label");const e="dt-radio-button-id"+ ++ks;this.radioElement.id=e,this.radioElement.type="radio",this.labelElement.htmlFor=e;o.createShadowRootWithCoreStyles(this,{cssFile:jn,delegatesFocus:void 0}).createChild("slot"),this.addEventListener("click",this.radioClickHandler.bind(this),!1)}radioClickHandler(){this.radioElement.checked||this.radioElement.disabled||(this.radioElement.checked=!0,this.radioElement.dispatchEvent(new Event("change")))}}o.registerCustomElement("span","dt-radio",Ts),o.registerCustomElement("span","dt-icon-label",Cs);class Ms extends HTMLSpanElement{sliderElement;constructor(){super();const e=o.createShadowRootWithCoreStyles(this,{cssFile:qn,delegatesFocus:void 0});this.sliderElement=document.createElement("input"),this.sliderElement.classList.add("dt-range-input"),this.sliderElement.type="range",e.appendChild(this.sliderElement)}set value(e){this.sliderElement.value=String(e)}get value(){return Number(this.sliderElement.value)}}o.registerCustomElement("span","dt-slider",Ms);class Ls extends HTMLSpanElement{textElement;constructor(){super();const e=o.createShadowRootWithCoreStyles(this,{cssFile:Gn,delegatesFocus:void 0});this.textElement=e.createChild("div"),this.textElement.className="info",this.textElement.createChild("slot")}set type(e){this.textElement.className=e}}o.registerCustomElement("span","dt-small-bubble",Ls);class Ps extends HTMLDivElement{buttonElement;constructor(){super();const e=o.createShadowRootWithCoreStyles(this,{cssFile:Vn,delegatesFocus:void 0});this.buttonElement=e.createChild("div","close-button"),ii.install(this.buttonElement,$n(Xn.close)),be(this.buttonElement,$n(Xn.close)),B(this.buttonElement);const t=Pe.create("cross","default-icon");this.buttonElement.appendChild(t)}setAccessibleName(e){be(this.buttonElement,e)}setTabbable(e){this.buttonElement.tabIndex=e?0:-1}}function Ds(e,t,i,n){if(i<=10)return"";t.length>200&&(t=n(t,200));const s=Rs(e,t);if(s<=i)return t;let o=0,r=t.length,a=0,l=s;for(;o<r&&a!==l&&a!==i;){const s=Math.ceil(o+(r-o)*(i-a)/(l-a)),h=Rs(e,n(t,s));h<=i?(o=s,a=h):(r=s-1,l=h)}return"…"!==(t=n(t,o))?t:""}function Rs(e,t){if(t.length>200)return e.measureText(t).width;As||(As=new Map);const i=e.font;let n=As.get(i);n||(n=new Map,As.set(i,n));let s=n.get(t);return s||(s=e.measureText(t).width,n.set(t,s)),s}o.registerCustomElement("div","dt-close-button",Ps);let As=null;function Os(e){return/(\?|&)utm_source=devtools/.test(e)?e:-1===e.indexOf("?")?e.replace(/^([^#]*)(#.*)?$/g,"$1?utm_source=devtools$2"):e.replace(/^([^#]*)(#.*)?$/g,"$1&utm_source=devtools$2")}function Bs(e){return/(\/\/developers.google.com\/|\/\/web.dev\/|\/\/developer.chrome.com\/)/.test(e)?Os(e):e}function Ws(e){return new Promise((t=>{const i=new Image;i.addEventListener("load",(()=>t(i))),i.addEventListener("error",(()=>t(null))),i.src=e}))}const Fs=(e,t)=>{let i=e;for(;i&&i!==e.ownerDocument;i=i.parentNodeOrShadowHost())for(let e=0;e<t.length;++e)if(i.nodeName.toLowerCase()===t[e].toLowerCase())return i;return null},Hs=(e,t,i)=>{let n=e,s=null;for(;n;){const e=n.elementFromPoint(t,i);if(!e||s===e)break;s=e,n=s.shadowRoot}return s},zs=e=>{const t=e;if(!(t.which||t.pageX||t.pageY||t.clientX||t.clientY||t.movementX||t.movementY))return null;const i=t.target&&t.target.getComponentRoot();return i?Hs(i,t.pageX,t.pageY):null},Ns=[];function _s(e){return Ns.filter((function(t){if(!t.contextTypes)return!0;for(const i of t.contextTypes())if(e instanceof i)return!0;return!1}))}var Vs=Object.freeze({__proto__:null,highlightedSearchResultClassName:"highlighted-search-result",highlightedCurrentSearchResultClassName:"current-search-result",installDragHandle:Qn,elementDragStart:Zn,isBeingEdited:function(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e;if(t.classList.contains("text-prompt")||"INPUT"===t.nodeName||"TEXTAREA"===t.nodeName)return!0;if(!is.size)return!1;let i=t;for(;i;){if(is.has(t))return!0;i=i.parentElementOrShadowHost()}return!1},isEditing:es,markBeingEdited:ts,StyleValueDelimiters:"  \t\n\"':;,/()",getValueModificationDirection:ss,modifiedFloatNumber:os,createReplacementString:rs,handleElementValueModifications:function(e,t,i,s,o){const r="ArrowUp"===e.key||"ArrowDown"===e.key||"wheel"===e.type,a="PageUp"===e.key||"PageDown"===e.key;if(!r&&!a)return!1;const l=t.getComponentSelection();if(!l||!l.rangeCount)return!1;const h=l.getRangeAt(0);if(!h.commonAncestorContainer.isSelfOrDescendant(t))return!1;const d=t.textContent,c=n.DOMUtilities.rangeOfWord(h.startContainer,h.startOffset,"  \t\n\"':;,/()",t),u=c.toString();if(s&&s(u))return!1;const m=rs(u,e,o);if(m){const t=document.createTextNode(m);c.deleteContents(),c.insertNode(t);const n=document.createRange();return n.setStart(t,0),n.setEnd(t,m.length),l.removeAllRanges(),l.addRange(n),e.handled=!0,e.preventDefault(),i&&i(d||"",m),!0}return!1},openLinkExternallyLabel:as,copyLinkAddressLabel:ls,copyFileNameLabel:function(){return $n(Xn.copyFileName)},anotherProfilerActiveLabel:function(){return $n(Xn.anotherProfilerIsAlreadyActive)},asyncStackTraceLabel:function(e,t){if(e){if("Promise.resolve"===e)return $n(Xn.promiseResolvedAsync);if("Promise.reject"===e)return $n(Xn.promiseRejectedAsync);if(("await"===e||"async function"===e)&&0!==t.length){e=`await in ${xs(t[t.length-1].functionName)}`}return $n(Xn.sAsync,{PH1:e})}return $n(Xn.asyncCall)},installComponentRootStyles:function(e){o.injectCoreStyles(e),e.classList.add("platform-"+s.Platform.platform()),s.Platform.isMac()||0!==o.measuredScrollbarWidth(e.ownerDocument)||e.classList.add("overlay-scrollbar-enabled")},ElementFocusRestorer:cs,highlightSearchResult:function(e,t,i,n){const s=us(e,[new r.TextRange.SourceRange(t,i)],n);return s.length?s[0]:null},highlightSearchResults:us,runCSSAnimationOnce:function(e,t){e.classList.contains(t)&&e.classList.remove(t),e.addEventListener("webkitAnimationEnd",(function i(){e.classList.remove(t),e.removeEventListener("webkitAnimationEnd",i,!1)}),!1),e.classList.add(t)},highlightRangesWithStyleClass:ms,applyDomChanges:function(e){for(let t=0,i=e.length;t<i;++t){const i=e[t];switch(i.type){case"added":i.parent?.insertBefore(i.node,i.nextSibling??null);break;case"changed":i.node.textContent=i.newText??null}}},revertDomChanges:function(e){for(let t=e.length-1;t>=0;--t){const i=e[t];switch(i.type){case"added":i.node.remove();break;case"changed":i.node.textContent=i.oldText??null}}},measurePreferredSize:ps,startBatchUpdate:function(){bs++||(fs=new gs(!1))},endBatchUpdate:function(){--bs||fs&&(fs.scheduleInvoke(),fs=null)},invokeOnceAfterBatchUpdate:vs,animateFunction:function(e,t,i,s,o){const r=e.performance.now();let a=e.requestAnimationFrame((function l(h){const d=n.NumberUtilities.clamp((h-r)/s,0,1);t(...i.map((e=>e.from+(e.to-e.from)*d))),d<1?a=e.requestAnimationFrame(l):o&&o()}));return()=>e.cancelAnimationFrame(a)},LongClickController:ws,initializeUIUtils:function(e){e.body.classList.toggle("inactive",!e.hasFocus()),e.defaultView&&(e.defaultView.addEventListener("focus",hs.bind(void 0,e),!1),e.defaultView.addEventListener("blur",ds.bind(void 0,e),!1)),e.addEventListener("focus",o.focusChanged.bind(void 0),!0);const t=e.body;Ks.setContainer(t)},beautifyFunctionName:xs,createTextChild:Es,createTextChildren:(e,...t)=>{for(const i of t)Es(e,i)},createTextButton:Is,createInput:Ss,createSelect:function(e,t){const i=document.createElement("select");i.classList.add("chrome-select"),be(i,e);for(const e of t)if(e instanceof Map)for(const[t,n]of e){const e=i.createChild("optgroup");e.label=t;for(const t of n)"string"==typeof t&&e.appendChild(new Option(t,t))}else"string"==typeof e&&i.add(new Option(e,e));return i},createLabel:function(e,t,i){const n=document.createElement("label");return t&&(n.className=t),n.textContent=e,i&&A(n,i),n},createRadioLabel:function(e,t,i){const n=document.createElement("span",{is:"dt-radio"});return n.radioElement.name=e,n.radioElement.checked=Boolean(i),Es(n.labelElement,t),n},createIconLabel:function(e){const t=document.createElement("span",{is:"dt-icon-label"});return e.title&&(t.createChild("span").textContent=e.title),t.data={iconName:e.iconName,color:e.color??"var(--icon-default)",width:e.width??"14px",height:e.height??"14px"},t},createSlider:function(e,t,i){const n=document.createElement("span",{is:"dt-slider"});return n.sliderElement.min=String(e),n.sliderElement.max=String(t),n.sliderElement.step=String(1),n.sliderElement.tabIndex=i,n},setTitle:function(e,t){be(e,t),ii.install(e,t)},CheckboxLabel:ys,DevToolsIconLabel:Cs,DevToolsRadioButton:Ts,DevToolsSlider:Ms,DevToolsSmallBubble:Ls,DevToolsCloseButton:Ps,bindInput:function(e,t,i,n,s){return e.addEventListener("change",(function(){const{valid:n}=i(e.value);e.classList.toggle("error-input",!n),n&&t(e.value)}),!1),e.addEventListener("input",(function(){e.classList.toggle("error-input",!i(e.value))}),!1),e.addEventListener("keydown",(function(o){if("Enter"===o.key){const{valid:n}=i(e.value);return n&&t(e.value),void o.preventDefault()}if(!n)return;const r=os(parseFloat(e.value),o,s),a=r?String(r):"",{valid:l}=i(a);if(!l||!r)return;e.value=a,t(e.value),o.preventDefault()}),!1),e.addEventListener("focus",e.select.bind(e),!1),function(t){if(t===e.value)return;const{valid:n}=i(t);e.classList.toggle("error-input",!n),e.value=t}},trimText:Ds,trimTextMiddle:function(e,t,i){return Ds(e,t,i,((e,t)=>n.StringUtilities.trimMiddle(e,t)))},trimTextEnd:function(e,t,i){return Ds(e,t,i,((e,t)=>n.StringUtilities.trimEndWithMaxLength(e,t)))},measureTextWidth:Rs,addReferrerToURL:Os,addReferrerToURLIfNecessary:Bs,loadImage:Ws,loadImageFromData:function(e){return e?Ws("data:image/jpg;base64,"+e):Promise.resolve(null)},createFileSelectorElement:function(e){const t=document.createElement("input");return t.type="file",t.style.display="none",t.tabIndex=-1,t.onchange=()=>{t.files&&e(t.files[0])},t},MaxLengthForDisplayedURLs:150,MessageDialog:class{static async show(e,t){const i=new Qs;i.setSizeBehavior("MeasureContent"),i.setDimmed(!0);const n=o.createShadowRootWithCoreStyles(i.contentElement,{cssFile:Un,delegatesFocus:void 0}).createChild("div","widget");await new Promise((s=>{const o=Is($n(Xn.ok),s,"",!0);n.createChild("div","message").createChild("span").textContent=e,n.createChild("div","button").appendChild(o),i.setOutsideClickCallback((e=>{e.consume(),s(void 0)})),i.show(t),o.focus()})),i.hide()}},ConfirmDialog:class{static async show(e,t){const i=new Qs;i.setSizeBehavior("MeasureContent"),i.setDimmed(!0),be(i.contentElement,e);const n=o.createShadowRootWithCoreStyles(i.contentElement,{cssFile:Un,delegatesFocus:void 0}).createChild("div","widget");n.createChild("div","message").createChild("span").textContent=e;const s=n.createChild("div","button"),r=await new Promise((e=>{const n=Is($n(Xn.ok),(()=>e(!0)),"",!0);s.appendChild(n),s.appendChild(Is($n(Xn.cancel),(()=>e(!1)))),i.setOutsideClickCallback((t=>{t.consume(),e(!1)})),i.show(t),n.focus()}));return i.hide(),r}},createInlineButton:function(e){const t=document.createElement("span"),i=o.createShadowRootWithCoreStyles(t,{cssFile:Kn,delegatesFocus:void 0});t.classList.add("inline-button");const n=new kn("");return n.appendToolbarItem(e),i.appendChild(n.element),t},Renderer:class{static async render(e,t){if(!e)throw new Error("Can't render "+e);const i=_s(e)[0];if(!i)return null;return(await i.loadRenderer()).render(e,t)}},formatTimestamp:function(e,t){const i=new Date(e),n=i.getFullYear()+"-"+o(i.getMonth()+1,2)+"-"+o(i.getDate(),2),s=o(i.getHours(),2)+":"+o(i.getMinutes(),2)+":"+o(i.getSeconds(),2)+"."+o(i.getMilliseconds(),3);return t?n+" "+s:s;function o(e,t){return String(e).padStart(t,"0")}},isScrolledToBottom:e=>Math.abs(e.scrollTop+e.clientHeight-e.scrollHeight)<=2,createSVGChild:function(e,t,i){const n=e.ownerDocument.createElementNS("http://www.w3.org/2000/svg",t);return i&&n.setAttribute("class",i),e.appendChild(n),n},enclosingNodeOrSelfWithNodeNameInArray:Fs,enclosingNodeOrSelfWithNodeName:function(e,t){return Fs(e,[t])},deepElementFromPoint:Hs,deepElementFromEvent:zs,registerRenderer:function(e){Ns.push(e)},getApplicableRegisteredRenderers:_s}),Us={cssContent:":host{position:absolute!important;top:0;bottom:0;left:0;right:0;overflow:hidden;contain:strict;background-color:transparent}:host-context(.dimmed-pane){background-color:var(--color-background-opacity-50)}:host-context(.no-pointer-events){pointer-events:none}.widget{display:flex;background-color:transparent;pointer-events:auto;flex:none}.no-pointer-events{pointer-events:none}.arrow-top{margin-top:-19px;margin-left:-9px}.arrow-bottom{margin-left:-9px}.arrow-left{margin-left:-19px;margin-top:-9px}.arrow-right{margin-top:-9px}.arrow-none{display:none}:host-context(.-theme-with-dark-background) .arrow{filter:invert(80%)}"};class Ks{widgetInternal;element;contentElement;arrowElement;onMouseDownBound;onClickOutsideCallback;maxSize;positionX;positionY;anchorBox;anchorBehavior;sizeBehavior;marginBehavior;#n=!1;constructor(){this.widgetInternal=new zt(!0),this.widgetInternal.markAsRoot(),this.element=this.widgetInternal.element,this.contentElement=this.widgetInternal.contentElement,this.arrowElement=Pe.create("","arrow hidden"),this.element.shadowRoot&&this.element.shadowRoot.appendChild(this.arrowElement),this.registerRequiredCSS(Us),this.setPointerEventsBehavior("PierceGlassPane"),this.onMouseDownBound=this.onMouseDown.bind(this),this.onClickOutsideCallback=null,this.maxSize=null,this.positionX=null,this.positionY=null,this.anchorBox=null,this.anchorBehavior="PreferTop",this.sizeBehavior="SetExactSize",this.marginBehavior="DefaultMargin"}isShowing(){return this.widgetInternal.isShowing()}registerRequiredCSS(e){this.widgetInternal.registerRequiredCSS(e)}registerCSSFiles(e){this.widgetInternal.registerCSSFiles(e)}setDefaultFocusedElement(e){this.widgetInternal.setDefaultFocusedElement(e)}setDimmed(e){this.element.classList.toggle("dimmed-pane",e)}setPointerEventsBehavior(e){this.element.classList.toggle("no-pointer-events","BlockedByGlassPane"!==e),this.contentElement.classList.toggle("no-pointer-events","PierceContents"===e)}setOutsideClickCallback(e){this.onClickOutsideCallback=e}setMaxContentSize(e){this.maxSize=e,this.positionContent()}setSizeBehavior(e){this.sizeBehavior=e,this.positionContent()}setContentPosition(e,t){this.positionX=e,this.positionY=t,this.positionContent()}setContentAnchorBox(e){this.anchorBox=e,this.positionContent()}setAnchorBehavior(e){this.anchorBehavior=e}setMarginBehavior(e){this.marginBehavior=e,this.arrowElement.classList.toggle("hidden","Arrow"!==e)}setIgnoreLeftMargin(e){this.#n=e}show(e){this.isShowing()||(this.element.style.zIndex=""+(3e3+1e3*qs.size),e.body.addEventListener("mousedown",this.onMouseDownBound,!0),e.body.addEventListener("pointerdown",this.onMouseDownBound,!0),this.widgetInternal.show(e.body),qs.add(this),this.positionContent())}hide(){this.isShowing()&&(qs.delete(this),this.element.ownerDocument.body.removeEventListener("mousedown",this.onMouseDownBound,!0),this.element.ownerDocument.body.removeEventListener("pointerdown",this.onMouseDownBound,!0),this.widgetInternal.detach())}onMouseDown(e){if(!this.onClickOutsideCallback)return;const t=zs(e);t&&!this.contentElement.isSelfOrAncestor(t)&&this.onClickOutsideCallback.call(null,e)}positionContent(){if(!this.isShowing())return;const e="Arrow"===this.marginBehavior,t=e?8:"NoMargin"===this.marginBehavior?0:3,i=o.measuredScrollbarWidth(this.element.ownerDocument),s=10,r=js.get(this.element.ownerDocument);"MeasureContent"===this.sizeBehavior&&(this.contentElement.positionAt(0,0),this.contentElement.style.width="",this.contentElement.style.maxWidth="",this.contentElement.style.height="",this.contentElement.style.maxHeight="");const a=r.offsetWidth,l=r.offsetHeight;let h=a-2*t,d=l-2*t,c=t,u=t;if(this.maxSize&&(h=Math.min(h,this.maxSize.width),d=Math.min(d,this.maxSize.height)),"MeasureContent"===this.sizeBehavior){const e=this.contentElement.getBoundingClientRect(),t=d<e.height?i:0,n=h<e.width?i:0;h=Math.min(h,e.width+t),d=Math.min(d,e.height+n)}if(this.anchorBox){const i=this.anchorBox.relativeToElement(r);let o=this.anchorBehavior;if(this.arrowElement.classList.remove("arrow-none","arrow-top","arrow-bottom","arrow-left","arrow-right"),"PreferTop"===o||"PreferBottom"===o){const m=i.y-2*t,p=l-i.y-i.height-2*t;let g;"PreferTop"===o&&m<d&&p>m&&(o="PreferBottom"),"PreferBottom"===o&&p<d&&m>p&&(o="PreferTop");let b=!0;if("PreferTop"===o){u=Math.max(t,i.y-d-t);const e=i.y-u-t;"MeasureContent"===this.sizeBehavior?d>e&&(this.arrowElement.classList.add("arrow-none"),b=!1):d=Math.min(d,e),this.arrowElement.setIconType("mediumicon-arrow-bottom"),this.arrowElement.classList.add("arrow-bottom"),g=i.y-t}else{u=i.y+i.height+t;const e=l-u-t;"MeasureContent"===this.sizeBehavior?d>e&&(this.arrowElement.classList.add("arrow-none"),u=l-t-d,b=!1):d=Math.min(d,e),this.arrowElement.setIconType("mediumicon-arrow-top"),this.arrowElement.classList.add("arrow-top"),g=i.y+i.height+t}const f=Math.min(i.x,a-h-t);if(c=Math.max(t,f),this.#n&&t>f&&(c=0),b?e&&c-s>=t&&(c-=s):c=Math.min(c+s,a-h-t),h=Math.min(h,a-c-t),20>=h)this.arrowElement.classList.add("arrow-none");else{let e=i.x+Math.min(50,Math.floor(i.width/2));e=n.NumberUtilities.clamp(e,c+s,c+h-s),this.arrowElement.positionAt(e,g,r)}}else{const m=i.x-2*t,p=a-i.x-i.width-2*t;let g;"PreferLeft"===o&&m<h&&p>m&&(o="PreferRight"),"PreferRight"===o&&p<h&&m>p&&(o="PreferLeft");let b=!0;if("PreferLeft"===o){c=Math.max(t,i.x-h-t);const e=i.x-c-t;"MeasureContent"===this.sizeBehavior?h>e&&(this.arrowElement.classList.add("arrow-none"),b=!1):h=Math.min(h,e),this.arrowElement.setIconType("mediumicon-arrow-right"),this.arrowElement.classList.add("arrow-right"),g=i.x-t}else{c=i.x+i.width+t;const e=a-c-t;"MeasureContent"===this.sizeBehavior?h>e&&(this.arrowElement.classList.add("arrow-none"),c=a-t-h,b=!1):h=Math.min(h,e),this.arrowElement.setIconType("mediumicon-arrow-left"),this.arrowElement.classList.add("arrow-left"),g=i.x+i.width+t}if(u=Math.max(t,Math.min(i.y,l-d-t)),b?e&&u-s>=t&&(u-=s):u=Math.min(u+s,l-d-t),d=Math.min(d,l-u-t),20>=d)this.arrowElement.classList.add("arrow-none");else{let e=i.y+Math.min(50,Math.floor(i.height/2));e=n.NumberUtilities.clamp(e,u+s,u+d-s),this.arrowElement.positionAt(g,e,r)}}}else c=null!==this.positionX?this.positionX:(a-h)/2,u=null!==this.positionY?this.positionY:(l-d)/2,h=Math.min(h,a-c-t),d=Math.min(d,l-u-t),this.arrowElement.classList.add("arrow-none");this.contentElement.style.width=h+"px","SetExactWidthMaxHeight"===this.sizeBehavior?this.contentElement.style.maxHeight=d+"px":this.contentElement.style.height=d+"px",this.contentElement.positionAt(c,u,r),this.widgetInternal.doResize()}widget(){return this.widgetInternal}static setContainer(e){js.set(e.ownerDocument,e),Ks.containerMoved(e)}static container(e){return js.get(e)}static containerMoved(e){for(const t of qs)t.isShowing()&&t.element.ownerDocument===e.ownerDocument&&t.positionContent()}}const js=new Map,qs=new Set,Gs=qs;var Xs,Ys=Object.freeze({__proto__:null,GlassPane:Ks,GlassPanePanes:Gs}),$s={cssContent:".widget{box-shadow:var(--drop-shadow);background:var(--color-background);justify-content:flex-start;align-items:stretch;display:flex}.dialog-close-button{position:absolute;right:9px;top:9px;z-index:1}"};class Qs extends(e.ObjectWrapper.eventMixin(Ks)){tabIndexBehavior;tabIndexMap;focusRestorer;closeOnEscape;targetDocument;targetDocumentKeyDownHandler;escapeKeyCallback;constructor(){super(),this.registerRequiredCSS($s),this.contentElement.tabIndex=0,this.contentElement.addEventListener("focus",(()=>this.widget().focus()),!1),this.widget().setDefaultFocusedElement(this.contentElement),this.setPointerEventsBehavior("BlockedByGlassPane"),this.setOutsideClickCallback((e=>{this.hide(),e.consume(!0)})),W(this.contentElement),this.tabIndexBehavior=Xs.DisableAllOutsideTabIndex,this.tabIndexMap=new Map,this.focusRestorer=null,this.closeOnEscape=!0,this.targetDocumentKeyDownHandler=this.onKeyDown.bind(this),this.escapeKeyCallback=null}static hasInstance(){return Boolean(Qs.instance)}show(e){const t=e instanceof Document?e:(e||qi.instance().element).ownerDocument;this.targetDocument=t,this.targetDocument.addEventListener("keydown",this.targetDocumentKeyDownHandler,!0),Qs.instance&&Qs.instance.hide(),Qs.instance=this,this.disableTabIndexOnElements(t),super.show(t),this.focusRestorer=new Ut(this.widget())}hide(){this.focusRestorer&&this.focusRestorer.restore(),super.hide(),this.targetDocument&&this.targetDocument.removeEventListener("keydown",this.targetDocumentKeyDownHandler,!0),this.restoreTabIndexOnElements(),this.dispatchEventToListeners("hidden"),Qs.instance=null}setCloseOnEscape(e){this.closeOnEscape=e}setEscapeKeyCallback(e){this.escapeKeyCallback=e}addCloseButton(){this.contentElement.createChild("div","dialog-close-button","dt-close-button").addEventListener("click",(()=>this.hide()),!1)}setOutsideTabIndexBehavior(e){this.tabIndexBehavior=e}disableTabIndexOnElements(e){if(this.tabIndexBehavior===Xs.PreserveTabIndex)return;let t=null;this.tabIndexBehavior===Xs.PreserveMainViewTabIndex&&(t=this.getMainWidgetTabIndexElements(qi.instance().ownerSplit())),this.tabIndexMap.clear();let i=e;for(;i;i=i.traverseNextNode(e))if(i instanceof HTMLElement){const e=i,n=e.tabIndex;t?.has(e)||(n>=0?(this.tabIndexMap.set(e,n),e.tabIndex=-1):e.hasAttribute("contenteditable")&&(this.tabIndexMap.set(e,e.hasAttribute("tabindex")?n:0),e.tabIndex=-1))}}getMainWidgetTabIndexElements(e){const t=new Set;if(!e)return t;const i=e.mainWidget();if(!i||!i.element)return t;let n=i.element;for(;n;n=n.traverseNextNode(i.element)){if(!(n instanceof HTMLElement))continue;const e=n;e.tabIndex<0||t.add(e)}return t}restoreTabIndexOnElements(){for(const e of this.tabIndexMap.keys())e.tabIndex=this.tabIndexMap.get(e);this.tabIndexMap.clear()}onKeyDown(e){if(e.keyCode===ot.Esc.code&&Ge.hasNoModifiers(e)){if(this.escapeKeyCallback&&this.escapeKeyCallback(e),e.handled)return;this.closeOnEscape&&(e.consume(!0),this.hide())}}static instance=null}!function(e){e.DisableAllOutsideTabIndex="DisableAllTabIndex",e.PreserveMainViewTabIndex="PreserveMainViewTabIndex",e.PreserveTabIndex="PreserveTabIndex"}(Xs||(Xs={}));var Zs=Object.freeze({__proto__:null,Dialog:Qs,get OutsideTabIndexBehavior(){return Xs}});let Js;class eo{actionRegistry;actionToShortcut;keyMap;activePrefixKey;activePrefixTimeout;consumePrefix;devToolsDefaultShortcutActions;disabledDefaultShortcutsForAction;keybindSetSetting;userShortcutsSetting;constructor(t){this.actionRegistry=t,this.actionToShortcut=new n.MapUtilities.Multimap,this.keyMap=new to(0,0),this.activePrefixKey=null,this.activePrefixTimeout=null,this.consumePrefix=null,this.devToolsDefaultShortcutActions=new Set,this.disabledDefaultShortcutsForAction=new n.MapUtilities.Multimap,this.keybindSetSetting=e.Settings.Settings.instance().moduleSetting("activeKeybindSet"),this.keybindSetSetting.addChangeListener((e=>{s.userMetrics.keybindSetSettingChanged(e.data),this.registerBindings()})),this.userShortcutsSetting=e.Settings.Settings.instance().moduleSetting("userShortcuts"),this.userShortcutsSetting.addChangeListener(this.registerBindings,this),this.registerBindings()}static instance(e={forceNew:null,actionRegistry:null}){const{forceNew:t,actionRegistry:i}=e;if(!Js||t){if(!i)throw new Error("Missing actionRegistry for shortcutRegistry");Js=new eo(i)}return Js}static removeInstance(){Js=void 0}applicableActions(e,t={}){let i=[];const n=(this.activePrefixKey||this.keyMap).getNode(e);n&&(i=n.actions());const s=this.actionRegistry.applicableActions(i,p.instance());if(n)for(const e of Object.keys(t))if(n.actions().indexOf(e)>=0){const t=this.actionRegistry.action(e);t&&s.push(t)}return s}shortcutsForAction(e){return[...this.actionToShortcut.get(e)]}actionsForDescriptors(e){let t=this.keyMap;for(const{key:i}of e){if(!t)return[];t=t.getNode(i)}return t?t.actions():[]}globalShortcutKeys(){const e=[];for(const t of this.keyMap.chords().values()){const i=t.actions();(this.actionRegistry.applicableActions(i,p.instance()).length||t.hasChords())&&e.push(t.key())}return e}keysForActions(e){const t=e.flatMap((e=>[...this.actionToShortcut.get(e)].flatMap((e=>e.descriptors.map((e=>e.key))))));return[...new Set(t)]}shortcutTitleForAction(e){for(const t of this.actionToShortcut.get(e))return t.title()}handleShortcut(e,t){this.handleKey(Ge.makeKeyFromEvent(e),e.key,e,t)}actionHasDefaultShortcut(e){return this.devToolsDefaultShortcutActions.has(e)}getShortcutListener(e){const t=Object.keys(e).flatMap((e=>[...this.actionToShortcut.get(e)])),i=new to(0,0);return t.forEach((e=>{i.addKeyMapping(e.descriptors.map((e=>e.key)),e.action)})),t=>{const n=Ge.makeKeyFromEvent(t),s=this.activePrefixKey?i.getNode(this.activePrefixKey.key()):i;s&&s.getNode(n)&&this.handleShortcut(t,e)}}addShortcutListener(e,t){const i=this.getShortcutListener(t);return e.addEventListener("keydown",i),i}async handleKey(e,t,i,n){const o=e>>8,r=Boolean(n)||Boolean(this.activePrefixKey),a=this.keyMap.getNode(e),l=this.applicableActions(e,n).length>0||a&&a.hasChords();if((r||!function(){if(!i||!es()||/^F\d+|Control|Shift|Alt|Meta|Escape|Win|U\+001B$/.test(t))return!1;if(!o)return!0;const n=Xe;if(s.Platform.isMac()){if(Ge.makeKey("z",n.Meta)===e)return!0;if(Ge.makeKey("z",n.Meta|n.Shift)===e)return!0}else{if(Ge.makeKey("z",n.Ctrl)===e)return!0;if(Ge.makeKey("y",n.Ctrl)===e)return!0;if(!s.Platform.isWin()&&Ge.makeKey("z",n.Ctrl|n.Shift)===e)return!0}if((o&(n.Ctrl|n.Alt))==(n.Ctrl|n.Alt))return s.Platform.isWin();return!h(n.Ctrl)&&!h(n.Alt)&&!h(n.Meta)}())&&l&&!Ge.isModifier(Ge.keyCodeAndModifiersFromKey(e).keyCode)&&(i&&i.consume(!0),r||!Qs.hasInstance())){if(this.activePrefixTimeout){clearTimeout(this.activePrefixTimeout);const e=await d.call(this);if(this.activePrefixKey=null,this.activePrefixTimeout=null,e)return;this.consumePrefix&&await this.consumePrefix()}a&&a.hasChords()?(this.activePrefixKey=a,this.consumePrefix=async()=>{this.activePrefixKey=null,this.activePrefixTimeout=null,await d.call(this)},this.activePrefixTimeout=window.setTimeout(this.consumePrefix,so)):await d.call(this)}function h(e){return Boolean(o&e)}async function d(){const t=this.applicableActions(e,n);if(!t.length)return!1;for(const e of t){let t;if(n&&n[e.id()]&&(t=await n[e.id()]()),n||(t=await e.execute()),t)return s.userMetrics.keyboardShortcutFired(e.id()),!0}return!1}}registerUserShortcut(e){for(const t of this.disabledDefaultShortcutsForAction.get(e.action))if(t.descriptorsMatch(e.descriptors)&&t.hasKeybindSet(this.keybindSetSetting.get()))return void this.removeShortcut(t);for(const t of this.actionToShortcut.get(e.action))if(t.descriptorsMatch(e.descriptors)&&t.hasKeybindSet(this.keybindSetSetting.get()))return;this.addShortcutToSetting(e)}removeShortcut(e){e.type===rt.DefaultShortcut||e.type===rt.KeybindSetShortcut?this.addShortcutToSetting(e.changeType(rt.DisabledDefault)):this.removeShortcutFromSetting(e)}disabledDefaultsForAction(e){return this.disabledDefaultShortcutsForAction.get(e)}addShortcutToSetting(e){const t=this.userShortcutsSetting.get();t.push(e),this.userShortcutsSetting.set(t)}removeShortcutFromSetting(e){const t=this.userShortcutsSetting.get(),i=t.findIndex(e.equals,e);-1!==i&&(t.splice(i,1),this.userShortcutsSetting.set(t))}registerShortcut(e){this.actionToShortcut.set(e.action,e),this.keyMap.addKeyMapping(e.descriptors.map((e=>e.key)),e.action)}registerBindings(){this.actionToShortcut.clear(),this.keyMap.clear();const e=this.keybindSetSetting.get();this.disabledDefaultShortcutsForAction.clear(),this.devToolsDefaultShortcutActions.clear();const t=[];if(i.Runtime.experiments.isEnabled("keyboardShortcutEditor")){const e=this.userShortcutsSetting.get();for(const i of e){const e=Ge.createShortcutFromSettingObject(i);e.type===rt.DisabledDefault?this.disabledDefaultShortcutsForAction.set(e.action,e):(no.has(e.action)&&t.push(...e.descriptors.map((e=>Ge.keyCodeAndModifiersFromKey(e.key)))),this.registerShortcut(e))}}for(const e of C()){const i=e.id(),s=e.bindings();for(let e=0;s&&e<s.length;++e){const r=s[e].keybindSets;if(!n(s[e].platform)||!o(r))continue;const a=s[e].shortcut.split(/\s+/).map(Ge.makeDescriptorFromBindingShortcut);if(a.length>0){if(this.isDisabledDefault(a,i)){this.devToolsDefaultShortcutActions.add(i);continue}no.has(i)&&t.push(...a.map((e=>Ge.keyCodeAndModifiersFromKey(e.key)))),r?(r.includes("devToolsDefault")&&this.devToolsDefaultShortcutActions.add(i),this.registerShortcut(new Ge(a,i,rt.KeybindSetShortcut,new Set(r)))):(this.devToolsDefaultShortcutActions.add(i),this.registerShortcut(new Ge(a,i,rt.DefaultShortcut)))}}}function n(e){if(!e)return!0;const t=e.split(",");let i=!1;const n=s.Platform.platform();for(let e=0;!i&&e<t.length;++e)i=t[e]===n;return i}function o(t){return!t||t.includes(e)}s.InspectorFrontendHost.InspectorFrontendHostInstance.setWhitelistedShortcuts(JSON.stringify(t))}isDisabledDefault(e,t){const i=this.disabledDefaultShortcutsForAction.get(t);for(const t of i)if(t.descriptorsMatch(e))return!0;return!1}}class to{keyInternal;actionsInternal;chordsInternal;depth;constructor(e,t=0){this.keyInternal=e,this.actionsInternal=[],this.chordsInternal=new Map,this.depth=t}addAction(e){this.actionsInternal.push(e)}key(){return this.keyInternal}chords(){return this.chordsInternal}hasChords(){return this.chordsInternal.size>0}addKeyMapping(e,t){if(!(e.length<this.depth))if(e.length===this.depth)this.addAction(t);else{const i=e[this.depth];this.chordsInternal.has(i)||this.chordsInternal.set(i,new to(i,this.depth+1)),this.chordsInternal.get(i).addKeyMapping(e,t)}}getNode(e){return this.chordsInternal.get(e)||null}actions(){return this.actionsInternal}clear(){this.actionsInternal=[],this.chordsInternal=new Map}}class io{static instance=new io}const no=new Set(["main.toggle-dock","debugger.toggle-breakpoints-active","debugger.toggle-pause","commandMenu.show","console.show"]),so=1e3,oo="devToolsDefault";var ro=Object.freeze({__proto__:null,ShortcutRegistry:eo,ShortcutTreeNode:to,ForwardedShortcut:io,ForwardedActions:no,KeyTimeout:so,DefaultShortcutSetting:oo}),ao={cssContent:".soft-context-menu{--override-context-menu-seperator-color:var(--color-details-hairline);--override-context-menu-hover-text-color:rgb(255 255 255);overflow-y:auto;min-width:160px!important;padding:4px 0;border:1px solid var(--color-details-hairline);background-color:var(--color-background);box-shadow:var(--drop-shadow)}:host-context(.-theme-with-dark-background) .soft-context-menu{border:none}:host:host-context(.platform-mac):host-context(html:not(.-theme-with-dark-background)) .soft-context-menu{--override-mac-specific-border-color:rgb(196 196 196/90%);--override-mac-specific-border-top-color:rgb(196 196 196/50%);--override-mac-specific-background-color:rgb(240 240 240);--override-mac-specific-box-shadow:0 5px 10px rgb(0 0 0 25%);--override-context-menu-seperator-color:rgb(222 222 222);border:1px solid var(--override-mac-specific-border-color);border-top:1px solid var(--override-mac-specific-border-top-color);border-radius:4px;background-color:var(--override-mac-specific-background-color);box-shadow:var(--override-mac-specific-box-shadow)}.dockside-title{padding-right:13px}.soft-context-menu-item{display:flex;width:100%;font-size:12px;padding:3px 7px 3px 8px;white-space:nowrap;align-items:center}.soft-context-menu-item devtools-icon{pointer-events:none}.soft-context-menu-disabled{color:var(--color-text-disabled);pointer-events:none}.soft-context-menu-separator{height:10px;margin:0 1px}.soft-context-menu-separator > .separator-line{margin:0;height:5px;border-bottom:1px solid var(--override-context-menu-seperator-color);pointer-events:none}.soft-context-menu-item-mouse-over{background-color:var(--color-primary-old);color:var(--override-context-menu-hover-text-color)}.soft-context-menu-item-mouse-over devtools-icon{--icon-color:var(--override-context-menu-hover-text-color)}.-theme-with-dark-background .soft-context-menu-item-mouse-over,\n:host-context(.-theme-with-dark-background) .soft-context-menu-item-mouse-over{--override-dark-mode-focus-color:#1a73e8;background-color:var(--override-dark-mode-focus-color)}:host:host-context(.platform-mac):host-context(html:not(.-theme-with-dark-background)) .soft-context-menu-item-mouse-over{--override-mac-specific-dark-background:linear-gradient(to right,hsl(214deg 81% 60%),hsl(214deg 100% 56%));background-image:var(--override-mac-specific-dark-background)}:host:host-context(.platform-mac):host-context(html:not(.-theme-with-dark-background)) .separator-line{border-width:2px}.soft-context-menu-item-submenu-arrow{pointer-events:none;font-size:11px;text-align:right;align-self:center;margin-left:auto}.soft-context-menu-item-mouse-over .soft-context-menu-item-checkmark{color:var(--legacy-selection-fg-color)}.soft-context-menu-custom-item{display:inline-flex;justify-content:center;align-items:center;flex:auto}.soft-context-menu-shortcut{color:var(--color-text-secondary);pointer-events:none;flex:1 1 auto;text-align:right;padding-left:10px}.soft-context-menu-item-mouse-over .soft-context-menu-shortcut{color:inherit}.checkmark{pointer-events:none;margin:-1px 5px -1px 0}.soft-context-menu-item-mouse-over .checkmark{opacity:100%;filter:none}:host-context(.-theme-with-dark-background) .checkmark{filter:invert(80%)}@media (forced-colors: active){.soft-context-menu-item{color:canvastext}.soft-context-menu-item-mouse-over,\n  .-theme-with-dark-background .soft-context-menu-item-mouse-over,\n  :host-context(.-theme-with-dark-background) .soft-context-menu-item-mouse-over{background-color:Highlight;color:HighlightText;forced-color-adjust:none}.soft-context-menu .soft-context-menu-item devtools-icon{--icon-color:ButtonText}.soft-context-menu .soft-context-menu-item-mouse-over devtools-icon{--icon-color:HighlightText}.soft-context-menu-shortcut{color:ButtonText}.soft-context-menu-item-mouse-over .soft-context-menu-shortcut{color:HighlightText}.soft-context-menu:focus-visible{forced-color-adjust:none;background:canvas;border-color:Highlight}.soft-context-menu-separator > .separator-line{border-bottom-color:ButtonText}.checkmark{opacity:100%}.spritesheet-smallicons:not(.icon-mask){filter:invert(100%)}.soft-context-menu-item-mouse-over .spritesheet-smallicons:not(.icon-mask){filter:invert(0)}}"};const lo={checked:"checked",unchecked:"unchecked",sSS:"{PH1}, {PH2}, {PH3}",sS:"{PH1}, {PH2}"},ho=t.i18n.registerUIStrings("ui/legacy/SoftContextMenu.ts",lo),co=t.i18n.getLocalizedString.bind(void 0,ho);class uo{items;itemSelectedCallback;parentMenu;highlightedMenuItemElement;detailsForElementMap;document;glassPane;contextMenuElement;focusRestorer;hideOnUserMouseDownUnlessInMenu;activeSubMenuElement;subMenu;onMenuClosed;focusOnTheFirstItem=!0;constructor(e,t,i,n){this.items=e,this.itemSelectedCallback=t,this.parentMenu=i,this.highlightedMenuItemElement=null,this.detailsForElementMap=new WeakMap,this.onMenuClosed=n}show(e,t){if(this.items.length){this.document=e,this.glassPane=new Ks,this.glassPane.setPointerEventsBehavior(this.parentMenu?"PierceGlassPane":"BlockedByGlassPane"),this.glassPane.registerRequiredCSS(ao),this.glassPane.setContentAnchorBox(t),this.glassPane.setSizeBehavior("MeasureContent"),this.glassPane.setMarginBehavior("NoMargin"),this.glassPane.setAnchorBehavior(this.parentMenu?"PreferRight":"PreferBottom"),this.contextMenuElement=this.glassPane.contentElement.createChild("div","soft-context-menu"),this.contextMenuElement.tabIndex=-1,j(this.contextMenuElement),this.contextMenuElement.addEventListener("mouseup",(e=>e.consume()),!1),this.contextMenuElement.addEventListener("keydown",this.menuKeyDown.bind(this),!1);for(let e=0;e<this.items.length;++e)this.contextMenuElement.appendChild(this.createMenuItem(this.items[e]));if(this.glassPane.show(e),this.focusRestorer=new cs(this.contextMenuElement),!this.parentMenu){this.hideOnUserMouseDownUnlessInMenu=e=>{let t=this.subMenu;for(;t;){if(t.contextMenuElement===e.composedPath()[0])return;t=t.subMenu}this.discard(),e.consume(!0)},this.document.body.addEventListener("mousedown",this.hideOnUserMouseDownUnlessInMenu,!1);const e=qi.maybeGetInspectorViewInstance()?.element;if(e){let t=!1;const i=new ResizeObserver((()=>{if(t)return i.disconnect(),void this.discard();t=!0}));i.observe(e)}if(this.contextMenuElement.children&&this.focusOnTheFirstItem){const e=this.contextMenuElement.children[0];this.highlightMenuItem(e,!1)}}}}setContextMenuElementLabel(e){this.contextMenuElement&&be(this.contextMenuElement,e)}discard(){this.subMenu&&this.subMenu.discard(),this.focusRestorer&&this.focusRestorer.restore(),this.glassPane&&(this.glassPane.hide(),delete this.glassPane,this.hideOnUserMouseDownUnlessInMenu&&(this.document&&this.document.body.removeEventListener("mousedown",this.hideOnUserMouseDownUnlessInMenu,!1),delete this.hideOnUserMouseDownUnlessInMenu)),this.parentMenu&&(delete this.parentMenu.subMenu,this.parentMenu.activeSubMenuElement&&(re(this.parentMenu.activeSubMenuElement,!1),delete this.parentMenu.activeSubMenuElement)),this.onMenuClosed?.()}createMenuItem(e){if("separator"===e.type)return this.createSeparator();if("subMenu"===e.type)return this.createSubMenu(e);const t=document.createElement("div");t.classList.add("soft-context-menu-item"),t.tabIndex=-1,q(t);const i=new a.Icon.Icon;i.data={iconName:"checkmark",color:"var(--icon-default)",width:"14px",height:"14px"},i.classList.add("checkmark"),i.style.minWidth="14px",i.style.minHeight="14px",t.appendChild(i),e.checked||(i.style.opacity="0"),e.tooltip&&ii.install(t,e.tooltip);const n={actionId:void 0,isSeparator:void 0,customElement:void 0,subItems:void 0,subMenuTimer:void 0};if(e.element&&!e.label){if(t.createChild("div","soft-context-menu-custom-item").appendChild(e.element),e.element?.classList.contains("location-menu")){const i=e.element.ariaLabel||"";e.element.ariaLabel="",be(t,i)}return n.customElement=e.element,this.detailsForElementMap.set(t,n),t}e.enabled||t.classList.add("soft-context-menu-disabled"),Es(t,e.label||""),e.element&&t.appendChild(e.element),t.createChild("span","soft-context-menu-shortcut").textContent=e.shortcut||"",t.addEventListener("mousedown",this.menuItemMouseDown.bind(this),!1),t.addEventListener("mouseup",this.menuItemMouseUp.bind(this),!1),t.addEventListener("mouseover",this.menuItemMouseOver.bind(this),!1),t.addEventListener("mouseleave",this.menuItemMouseLeave.bind(this),!1),n.actionId=e.id;let s=e.label||"";if("checkbox"===e.type){const t=e.checked?co(lo.checked):co(lo.unchecked);s=e.shortcut?co(lo.sSS,{PH1:String(e.label),PH2:e.shortcut,PH3:t}):co(lo.sS,{PH1:String(e.label),PH2:t})}else e.shortcut&&(s=co(lo.sS,{PH1:String(e.label),PH2:e.shortcut}));return be(t,s),this.detailsForElementMap.set(t,n),t}createSubMenu(e){const t=document.createElement("div");t.classList.add("soft-context-menu-item"),t.tabIndex=-1,X(t),this.detailsForElementMap.set(t,{subItems:e.subItems,actionId:void 0,isSeparator:void 0,customElement:void 0,subMenuTimer:void 0});const i=new a.Icon.Icon;if(i.data={iconName:"checkmark",color:"var(--icon-default)",width:"14px",height:"14px"},i.classList.add("checkmark","soft-context-menu-item-checkmark"),t.appendChild(i),i.style.minWidth="14px",i.style.opacity="0",Es(t,e.label||""),re(t,!1),s.Platform.isMac()&&!c.ThemeSupport.instance().hasTheme()){const e=t.createChild("span","soft-context-menu-item-submenu-arrow");ee(e),e.textContent="▶"}else{const e=Pe.create("triangle-right","soft-context-menu-item-submenu-arrow");t.appendChild(e)}return t.addEventListener("mousedown",this.menuItemMouseDown.bind(this),!1),t.addEventListener("mouseup",this.menuItemMouseUp.bind(this),!1),t.addEventListener("mouseover",this.menuItemMouseOver.bind(this),!1),t.addEventListener("mouseleave",this.menuItemMouseLeave.bind(this),!1),t}createSeparator(){const e=document.createElement("div");return e.classList.add("soft-context-menu-separator"),this.detailsForElementMap.set(e,{subItems:void 0,actionId:void 0,isSeparator:!0,customElement:void 0,subMenuTimer:void 0}),e.createChild("div","separator-line"),e}menuItemMouseDown(e){e.consume(!0)}menuItemMouseUp(e){this.triggerAction(e.target,e),e.consume()}root(){let e=this;for(;e.parentMenu;)e=e.parentMenu;return e}triggerAction(e,t){const i=this.detailsForElementMap.get(e);if(i&&!i.subItems)return this.root().discard(),t.consume(!0),void(void 0!==i.actionId&&(this.itemSelectedCallback(i.actionId),delete i.actionId));this.showSubMenu(e),t.consume()}showSubMenu(e){const t=this.detailsForElementMap.get(e);if(!t)return;if(t.subMenuTimer&&(window.clearTimeout(t.subMenuTimer),delete t.subMenuTimer),this.subMenu||!this.document)return;if(this.activeSubMenuElement=e,re(e,!0),!t.subItems)return;this.subMenu=new uo(t.subItems,this.itemSelectedCallback,this);const i=e.boxInWindow();i.y-=5,i.x+=3,i.width-=6,i.height+=10,this.subMenu.show(this.document,i)}menuItemMouseOver(e){this.highlightMenuItem(e.target,!0)}menuItemMouseLeave(e){if(!this.subMenu||!e.relatedTarget)return void this.highlightMenuItem(null,!0);e.relatedTarget===this.contextMenuElement&&this.highlightMenuItem(null,!0)}highlightMenuItem(e,t){if(this.highlightedMenuItemElement!==e){if(this.subMenu&&this.subMenu.discard(),this.highlightedMenuItemElement){const e=this.detailsForElementMap.get(this.highlightedMenuItemElement);this.highlightedMenuItemElement.classList.remove("force-white-icons"),this.highlightedMenuItemElement.classList.remove("soft-context-menu-item-mouse-over"),e&&e.subItems&&e.subMenuTimer&&(window.clearTimeout(e.subMenuTimer),delete e.subMenuTimer)}if(this.highlightedMenuItemElement=e,this.highlightedMenuItemElement){this.highlightedMenuItemElement.classList.add("force-white-icons"),this.highlightedMenuItemElement.classList.add("soft-context-menu-item-mouse-over");const e=this.detailsForElementMap.get(this.highlightedMenuItemElement);e&&e.customElement&&!e.customElement.classList.contains("location-menu")?e.customElement.focus():this.highlightedMenuItemElement.focus(),t&&e&&e.subItems&&!e.subMenuTimer&&(e.subMenuTimer=window.setTimeout(this.showSubMenu.bind(this,this.highlightedMenuItemElement),150))}this.contextMenuElement&&ve(this.contextMenuElement,e)}}highlightPrevious(){let e=this.highlightedMenuItemElement?this.highlightedMenuItemElement.previousSibling:this.contextMenuElement?this.contextMenuElement.lastChild:null,t=e?this.detailsForElementMap.get(e):void 0;for(;e&&t&&(t.isSeparator||e.classList.contains("soft-context-menu-disabled"));)e=e.previousSibling,t=e?this.detailsForElementMap.get(e):void 0;e&&this.highlightMenuItem(e,!1)}highlightNext(){let e=this.highlightedMenuItemElement?this.highlightedMenuItemElement.nextSibling:this.contextMenuElement?this.contextMenuElement.firstChild:null,t=e?this.detailsForElementMap.get(e):void 0;for(;e&&(t&&t.isSeparator||e.classList.contains("soft-context-menu-disabled"));)e=e.nextSibling,t=e?this.detailsForElementMap.get(e):void 0;e&&this.highlightMenuItem(e,!1)}menuKeyDown(e){const t=e;function i(){if(!this.highlightedMenuItemElement)return;const e=this.detailsForElementMap.get(this.highlightedMenuItemElement);e&&!e.customElement&&(this.triggerAction(this.highlightedMenuItemElement,t),e.subItems&&this.subMenu&&this.subMenu.highlightNext(),t.consume(!0))}switch(t.key){case"ArrowUp":this.highlightPrevious(),t.consume(!0);break;case"ArrowDown":this.highlightNext(),t.consume(!0);break;case"ArrowLeft":this.parentMenu&&(this.highlightMenuItem(null,!1),this.discard()),t.consume(!0);break;case"ArrowRight":{if(!this.highlightedMenuItemElement)break;const e=this.detailsForElementMap.get(this.highlightedMenuItemElement);e&&e.subItems&&(this.showSubMenu(this.highlightedMenuItemElement),this.subMenu&&this.subMenu.highlightNext()),e?.customElement?.classList.contains("location-menu")&&(e.customElement.dispatchEvent(new KeyboardEvent("keydown",{key:"ArrowRight"})),this.highlightMenuItem(null,!0)),t.consume(!0);break}case"Escape":this.discard(),t.consume(!0);break;case"Enter":if("Enter"!==t.key)return;i.call(this);break;case" ":i.call(this);break;default:t.consume(!0)}}markAsMenuItemCheckBox(){if(this.contextMenuElement)for(const e of this.contextMenuElement.children)"soft-context-menu-separator"!==e.className&&G(e)}setFocusOnTheFirstItem(e){this.focusOnTheFirstItem=e}}var mo=Object.freeze({__proto__:null,SoftContextMenu:uo});class po{typeInternal;label;disabled;checked;contextMenu;idInternal;customElement;shortcut;#s;constructor(e,t,i,n,s,o){this.typeInternal=t,this.label=i,this.disabled=n,this.checked=s,this.contextMenu=e,this.idInternal=void 0,this.#s=o,"item"!==t&&"checkbox"!==t||(this.idInternal=e?e.nextId():0)}id(){if(void 0===this.idInternal)throw new Error("Tried to access a ContextMenu Item ID but none was set.");return this.idInternal}type(){return this.typeInternal}isEnabled(){return!this.disabled}setEnabled(e){this.disabled=!e}buildDescriptor(){switch(this.typeInternal){case"item":{const e={type:"item",id:this.idInternal,label:this.label,enabled:!this.disabled,checked:void 0,subItems:void 0,tooltip:this.#s};return this.customElement&&(e.element=this.customElement),this.shortcut&&(e.shortcut=this.shortcut),e}case"separator":return{type:"separator",id:void 0,label:void 0,enabled:void 0,checked:void 0,subItems:void 0};case"checkbox":{const e={type:"checkbox",id:this.idInternal,label:this.label,checked:Boolean(this.checked),enabled:!this.disabled,subItems:void 0};return this.customElement&&(e.element=this.customElement),e}}throw new Error("Invalid item type:"+this.typeInternal)}setShortcut(e){this.shortcut=e}}class go{contextMenu;items;constructor(e){this.contextMenu=e,this.items=[]}appendItem(e,t,i,n,s){const o=new po(this.contextMenu,"item",e,i,void 0,s);return n&&(o.customElement=n),this.items.push(o),this.contextMenu&&this.contextMenu.setHandler(o.id(),t),o}appendCustomItem(e){const t=new po(this.contextMenu,"item");return t.customElement=e,this.items.push(t),t}appendSeparator(){const e=new po(this.contextMenu,"separator");return this.items.push(e),e}appendAction(e,t,i){const n=L.instance().action(e);if(!n)return void(i||console.error(`Action ${e} was not defined`));t||(t=n.title());const s=this.appendItem(t,n.execute.bind(n)),o=eo.instance().shortcutTitleForAction(e);o&&s.setShortcut(o)}appendSubMenuItem(e,t){const i=new bo(this.contextMenu,e,t);return i.init(),this.items.push(i),i}appendCheckboxItem(e,t,i,n,s){const o=new po(this.contextMenu,"checkbox",e,n,i);return this.items.push(o),this.contextMenu&&this.contextMenu.setHandler(o.id(),t),s&&(o.customElement=s),o}}class bo extends po{sections;sectionList;constructor(e,t,i){super(e,"subMenu",t,i),this.sections=new Map,this.sectionList=[]}init(){fo.groupWeights.forEach((e=>this.section(e)))}section(e){let t=e?this.sections.get(e):null;return t||(t=new go(this.contextMenu),e?(this.sections.set(e,t),this.sectionList.push(t)):this.sectionList.splice(fo.groupWeights.indexOf("default"),0,t)),t}headerSection(){return this.section("header")}newSection(){return this.section("new")}revealSection(){return this.section("reveal")}clipboardSection(){return this.section("clipboard")}editSection(){return this.section("edit")}debugSection(){return this.section("debug")}viewSection(){return this.section("view")}defaultSection(){return this.section("default")}saveSection(){return this.section("save")}footerSection(){return this.section("footer")}buildDescriptor(){const e={type:"subMenu",label:this.label,enabled:!this.disabled,subItems:[],id:void 0,checked:void 0},t=this.sectionList.filter((e=>Boolean(e.items.length)));for(const i of t){for(const t of i.items)e.subItems||(e.subItems=[]),e.subItems.push(t.buildDescriptor());i!==t[t.length-1]&&(e.subItems||(e.subItems=[]),e.subItems.push({type:"separator",id:void 0,subItems:void 0,checked:void 0,enabled:void 0,label:void 0}))}return e}appendItemsAtLocation(e){const t=wo;t.sort(((e,t)=>(e.order||0)-(t.order||0)));for(const n of t){if(n.experiment&&!i.Runtime.experiments.isEnabled(n.experiment))continue;const t=n.location,s=n.actionId;if(!t||!t.startsWith(e+"/"))continue;const o=t.substr(e.length+1);o&&!o.includes("/")&&(s&&this.section(o).appendAction(s))}}static uniqueSectionName=0}class fo extends bo{contextMenu;defaultSectionInternal;pendingPromises;pendingTargets;event;useSoftMenu;x;y;onSoftMenuClosed;handlers;idInternal;softMenu;contextMenuLabel;constructor(e,t={}){super(null);const i=e;this.contextMenu=this,super.init(),this.defaultSectionInternal=this.defaultSection(),this.pendingPromises=[],this.pendingTargets=[],this.event=i,this.useSoftMenu=Boolean(t.useSoftMenu),this.x=void 0===t.x?i.x:t.x,this.y=void 0===t.y?i.y:t.y,this.onSoftMenuClosed=t.onSoftMenuClosed,this.handlers=new Map,this.idInternal=0;const n=zs(e);n&&this.appendApplicableItems(n)}static initialize(){s.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(s.InspectorFrontendHostAPI.Events.SetUseSoftMenu,(function(e){fo.useSoftMenu=e.data}))}static installHandler(e){e.body.addEventListener("contextmenu",(function(e){new fo(e).show()}),!1)}nextId(){return this.idInternal++}async show(){fo.pendingMenu=this,this.event.consume(!0);const e=await Promise.all(this.pendingPromises);if(fo.pendingMenu===this){fo.pendingMenu=null;for(let t=0;t<e.length;++t){const i=e[t],n=this.pendingTargets[t];for(const e of i)e.appendApplicableItems(this.event,this,n)}this.pendingPromises=[],this.pendingTargets=[],this.innerShow()}}discard(){this.softMenu&&this.softMenu.discard()}innerShow(){const e=this.buildMenuDescriptors(),t=this.event.target;if(!t)return;const i=t.ownerDocument;if(this.useSoftMenu||fo.useSoftMenu||s.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()){this.softMenu=new uo(e,this.itemSelected.bind(this),void 0,this.onSoftMenuClosed);const t="mouse"===this.event.pointerType&&this.event.button>=0;this.softMenu.setFocusOnTheFirstItem(!t),this.softMenu.show(i,new AnchorBox(this.x,this.y,0,0)),this.contextMenuLabel&&this.softMenu.setContextMenuElementLabel(this.contextMenuLabel)}else{function t(){s.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(s.InspectorFrontendHostAPI.Events.ContextMenuCleared,this.menuCleared,this),s.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(s.InspectorFrontendHostAPI.Events.ContextMenuItemSelected,this.onItemSelected,this)}s.InspectorFrontendHost.InspectorFrontendHostInstance.showContextMenuAtPoint(this.x,this.y,e,i),queueMicrotask(t.bind(this))}}setContextMenuLabel(e){this.contextMenuLabel=e}setX(e){this.x=e}setY(e){this.y=e}setHandler(e,t){t&&this.handlers.set(e,t)}buildMenuDescriptors(){return super.buildDescriptor().subItems}onItemSelected(e){this.itemSelected(e.data)}itemSelected(e){const t=this.handlers.get(e);t&&t.call(this),this.menuCleared()}menuCleared(){s.InspectorFrontendHost.InspectorFrontendHostInstance.events.removeEventListener(s.InspectorFrontendHostAPI.Events.ContextMenuCleared,this.menuCleared,this),s.InspectorFrontendHost.InspectorFrontendHostInstance.events.removeEventListener(s.InspectorFrontendHostAPI.Events.ContextMenuItemSelected,this.onItemSelected,this)}containsTarget(e){return this.pendingTargets.indexOf(e)>=0}appendApplicableItems(e){this.pendingPromises.push(async function(e){return Promise.all(vo.filter(t).map((e=>e.loadProvider())));function t(t){if(!i.Runtime.Runtime.isDescriptorEnabled({experiment:t.experiment,condition:void 0}))return!1;if(!t.contextTypes)return!0;for(const i of t.contextTypes())if(e instanceof i)return!0;return!1}}(e)),this.pendingTargets.push(e)}markAsMenuItemCheckBox(){this.softMenu&&this.softMenu.markAsMenuItemCheckBox()}static pendingMenu=null;static useSoftMenu=!1;static groupWeights=["header","new","reveal","edit","clipboard","debug","view","default","save","footer"]}const vo=[];const wo=[];var xo;!function(e){e.DEVICE_MODE_MENU_SAVE="deviceModeMenu/save",e.MAIN_MENU="mainMenu",e.MAIN_MENU_DEFAULT="mainMenu/default",e.MAIN_MENU_FOOTER="mainMenu/footer",e.MAIN_MENU_HELP_DEFAULT="mainMenuHelp/default",e.NAVIGATOR_MENU_DEFAULT="navigatorMenu/default",e.TIMELINE_MENU_OPEN="timelineMenu/open"}(xo||(xo={}));var Eo=Object.freeze({__proto__:null,Item:po,Section:go,SubMenu:bo,ContextMenu:fo,registerProvider:function(e){vo.push(e)},registerItem:function(e){wo.push(e)},maybeRemoveItem:function(e){const t=wo.findIndex((t=>t.actionId===e.actionId&&t.location===e.location));return!(t<0)&&(wo.splice(t,1),!0)},get ItemLocation(){return xo}}),Io={cssContent:":host{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;background-color:var(--color-background-opacity-80);z-index:1000}.drop-target-message{flex:auto;font-size:30px;color:var(--color-text-secondary);display:flex;justify-content:center;align-items:center;margin:20px;border:4px dashed var(--color-details-hairline);pointer-events:none}"};var So=Object.freeze({__proto__:null,DropTarget:class{element;transferTypes;messageText;handleDrop;enabled;dragMaskElement;constructor(e,t,i,n){e.addEventListener("dragenter",this.onDragEnter.bind(this),!0),e.addEventListener("dragover",this.onDragOver.bind(this),!0),this.element=e,this.transferTypes=t,this.messageText=i,this.handleDrop=n,this.enabled=!0,this.dragMaskElement=null}setEnabled(e){this.enabled=e}onDragEnter(e){this.enabled&&this.hasMatchingType(e)&&e.consume(!0)}hasMatchingType(e){const t=e;if(!t.dataTransfer)return!1;for(const e of this.transferTypes){if(Array.from(t.dataTransfer.items).find((t=>e.kind===t.kind&&Boolean(e.type.exec(t.type)))))return!0}return!1}onDragOver(e){const t=e;if(!this.enabled||!this.hasMatchingType(t))return;if(t.dataTransfer&&(t.dataTransfer.dropEffect="copy"),t.consume(!0),this.dragMaskElement)return;this.dragMaskElement=this.element.createChild("div","");o.createShadowRootWithCoreStyles(this.dragMaskElement,{cssFile:Io,delegatesFocus:void 0}).createChild("div","drop-target-message").textContent=this.messageText,this.dragMaskElement.addEventListener("drop",this.onDrop.bind(this),!0),this.dragMaskElement.addEventListener("dragleave",this.onDragLeave.bind(this),!0)}onDrop(e){const t=e;t.consume(!0),this.removeMask(),this.enabled&&t.dataTransfer&&this.handleDrop(t.dataTransfer)}onDragLeave(e){e.consume(!0),this.removeMask()}removeMask(){this.dragMaskElement&&(this.dragMaskElement.remove(),this.dragMaskElement=null)}},Type:{URI:{kind:"string",type:/text\/uri-list/},Folder:{kind:"file",type:/$^/},File:{kind:"file",type:/.*/},WebFile:{kind:"file",type:/[\w]+/},ImageFile:{kind:"file",type:/image\/.*/}}}),yo={cssContent:".empty-bold-text{display:block;font-size:1.5em;margin:0.83em 0;font-weight:bold}.empty-view{color:var(--color-text-secondary);padding:30px;text-align:center;min-width:70px}.empty-view-scroller{justify-content:center;overflow:auto}.empty-view p{white-space:initial;line-height:18px;max-width:300px;flex-shrink:0}"};function Co(e){return e.data}function ko(e,t){e.data=t}class To{elementInternal;elementsById;constructor(e){this.elementInternal=e,this.elementsById=new Map}element(){return this.elementInternal}$(e){return this.elementsById.get(e)}static build(e,...t){return To.render(To.template(e),t)}static cached(e,...t){let i=Ao.get(e);return i||(i=To.template(e),Ao.set(e,i)),To.render(i,t)}static template(e){let t="",i=!0;for(let n=0;n<e.length-1;n++){t+=e[n];const s=e[n].lastIndexOf(">"),o=e[n].indexOf("<",s+1);-1!==s&&-1===o?i=!0:-1!==o&&(i=!1),t+=i?Mo:Po(n)}t+=e[e.length-1];const n=document.createElement("template");n.innerHTML=t;const s=n.ownerDocument.createTreeWalker(n.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);let o=0;const r=[],a=[],l=[];for(;s.nextNode();){const e=s.currentNode;if(e.nodeType===Node.ELEMENT_NODE&&e.hasAttributes()){e.hasAttribute("$")&&(l.push(e),a.push({replaceNodeIndex:void 0,attr:void 0,elementId:e.getAttribute("$")||""}),e.removeAttribute("$"));const t=[];for(let i=0;i<e.attributes.length;i++){const n=e.attributes[i].name;if(!Do.test(n)&&!Do.test(e.attributes[i].value))continue;t.push(n),l.push(e);const s={index:o,names:n.split(Do),values:e.attributes[i].value.split(Do)};o+=s.names.length-1,o+=s.values.length-1;const r={elementId:void 0,replaceNodeIndex:void 0,attr:s};a.push(r)}for(let i=0;i<t.length;i++)e.removeAttribute(t[i])}if(e.nodeType===Node.TEXT_NODE&&-1!==Co(e).indexOf(Mo)){const t=Co(e).split(Lo);ko(e,t[t.length-1]);const i=e.parentNode;for(let n=0;n<t.length-1;n++){t[n]&&i.insertBefore(document.createTextNode(t[n]),e);const s=document.createElement("span");l.push(s),a.push({attr:void 0,elementId:void 0,replaceNodeIndex:o++}),i.insertBefore(s,e)}}e.nodeType!==Node.TEXT_NODE||e.previousSibling&&e.previousSibling.nodeType!==Node.ELEMENT_NODE||e.nextSibling&&e.nextSibling.nodeType!==Node.ELEMENT_NODE||!/^\s*$/.test(Co(e))||r.push(e)}for(let e=0;e<l.length;e++)l[e].classList.add(Ro(e));for(const e of r)e.remove();return{template:n,binds:a}}static render(e,t){const i=e.template.ownerDocument.importNode(e.template.content,!0),n=i.firstChild===i.lastChild?i.firstChild:i,s=new To(n),o=[];for(let t=0;t<e.binds.length;t++){const e=Ro(t),n=i.querySelector("."+e);n.classList.remove(e),o.push(n)}for(let i=0;i<e.binds.length;i++){const n=e.binds[i],r=o[i];if(void 0!==n.elementId)s.elementsById.set(n.elementId,r);else if(void 0!==n.replaceNodeIndex){const e=t[n.replaceNodeIndex];r.parentNode.replaceChild(this.nodeForValue(e),r)}else{if(void 0===n.attr)throw new Error("Unexpected bind");if(2===n.attr.names.length&&1===n.attr.values.length&&"function"==typeof t[n.attr.index])t[n.attr.index].call(null,r);else{let e=n.attr.names[0];for(let i=1;i<n.attr.names.length;i++)e+=t[n.attr.index+i-1],e+=n.attr.names[i];if(e){let i=n.attr.values[0];for(let e=1;e<n.attr.values.length;e++)i+=t[n.attr.index+n.attr.names.length-1+e-1],i+=n.attr.values[e];r.setAttribute(e,i)}}}}return s}static nodeForValue(e){if(e instanceof Node)return e;if(e instanceof To)return e.elementInternal;if(Array.isArray(e)){const t=document.createDocumentFragment();for(const i of e)t.appendChild(this.nodeForValue(i));return t}return document.createTextNode(String(e))}}const Mo="{{template-text}}",Lo=/{{template-text}}/,Po=e=>"template-attribute"+e,Do=/template-attribute\d+/,Ro=e=>"template-class-"+e,Ao=new Map,Oo=(e,...t)=>To.cached(e,...t).element();var Bo=Object.freeze({__proto__:null,Fragment:To,textMarker:Mo,attributeMarker:Po,html:Oo});class Wo extends Dt{hrefInternal;clickable;onClick;onKeyDown;static create(e,t,i,s){t||(t=e);return Oo` <x-link href="${e}" tabindex="0" class="${i=i||""} devtools-link" ${s?"no-click":""}>${n.StringUtilities.trimMiddle(t,150)}</x-link>`}constructor(){super(),this.style.setProperty("display","inline"),H(this),this.setAttribute("tabindex","0"),this.setAttribute("target","_blank"),this.setAttribute("rel","noopener"),this.hrefInternal=null,this.clickable=!0,this.onClick=e=>{e.consume(!0),this.hrefInternal&&s.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(this.hrefInternal),this.dispatchEvent(new Event("x-link-invoke"))},this.onKeyDown=e=>{n.KeyboardUtilities.isEnterOrSpaceKey(e)&&(e.consume(!0),this.hrefInternal&&s.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(this.hrefInternal)),this.dispatchEvent(new Event("x-link-invoke"))}}static get observedAttributes(){return Dt.observedAttributes.concat(["href","no-click"])}get href(){return this.hrefInternal}attributeChangedCallback(e,t,i){if("no-click"===e)return this.clickable=!i,void this.updateClick();if("href"===e){i||(i="");let e=null,t=null;try{t=new URL(Bs(i)),e=t.toString()}catch{}return t&&"javascript:"===t.protocol&&(e=null),this.hrefInternal=e,ii.install(this,i),void this.updateClick()}super.attributeChangedCallback(e,t,i)}updateClick(){null!==this.hrefInternal&&this.clickable?(this.addEventListener("click",this.onClick,!1),this.addEventListener("keydown",this.onKeyDown,!1),this.style.setProperty("cursor","pointer")):(this.removeEventListener("click",this.onClick,!1),this.removeEventListener("keydown",this.onKeyDown,!1),this.style.removeProperty("cursor"))}}let Fo;class Ho{static instance(e={forceNew:null}){const{forceNew:t}=e;return Fo&&!t||(Fo=new Ho),Fo}appendApplicableItems(e,t,i){let n=i;for(;n&&!(n instanceof Wo);)n=n.parentNodeOrShadowHost();if(!n||!n.href)return;const o=n;t.revealSection().appendItem(as(),(()=>{o.href&&s.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(o.href)})),t.revealSection().appendItem(ls(),(()=>{o.href&&s.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(o.href)}))}}d.CustomElements.defineComponent("x-link",Wo);const zo=u.html`<p>Hello, <x-link>world!</x-link>`;var No=Object.freeze({__proto__:null,XLink:Wo,ContextMenuProvider:Ho,sample:zo});const _o={learnMore:"Learn more"},Vo=t.i18n.registerUIStrings("ui/legacy/EmptyWidget.ts",_o),Uo=t.i18n.getLocalizedString.bind(void 0,Vo);var Ko=Object.freeze({__proto__:null,EmptyWidget:class extends _t{textElement;constructor(e){super(),this.registerRequiredCSS(yo),this.element.classList.add("empty-view-scroller"),this.contentElement=this.element.createChild("div","empty-view"),this.textElement=this.contentElement.createChild("div","empty-bold-text"),this.textElement.textContent=e}appendParagraph(){return this.contentElement.createChild("p")}appendLink(e){return this.contentElement.appendChild(Wo.create(e,Uo(_o.learnMore)))}set text(e){this.textElement.textContent=e}}}),jo={cssContent:'.filter-bar{background-color:var(--color-background-elevation-1);flex:none;flex-wrap:wrap;align-items:center;border-bottom:var(--legacy-divider-border)}.filter-text-filter{display:inline-flex;margin-left:1px;margin-right:2px;min-width:40px;max-width:200px;height:24px;align-items:center}.filter-bitset-filter{padding:2px;display:inline-flex;overflow:hidden;height:24px;position:relative;margin:0}.filter-bitset-filter span{color:var(--color-text-primary);display:inline-block;flex:none;margin:auto 2px;padding:3px;background:transparent;border-radius:6px;overflow:hidden;cursor:pointer;line-height:1.2}.filter-bitset-filter span:focus-visible{outline:-webkit-focus-ring-color auto 5px}.filter-bitset-filter-divider{background-color:var(--color-details-hairline);height:16px;width:1px;margin:auto 2px;display:inline-block}.filter-bitset-filter span:hover{background:var(--color-background-elevation-2)}.filter-bitset-filter span.selected,\n.filter-bitset-filter span:active{background:var(--color-background-highlight)}.filter-checkbox-filter{padding-left:4px;padding-right:2px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:inline-flex;vertical-align:middle;height:24px;position:relative}.filter-checkbox-filter > [is="dt-checkbox"]{display:flex;margin:auto 0}.filter-input-field{padding-left:3px;width:163px;height:18px;line-height:20px;display:inline-block;overflow:hidden;white-space:nowrap;cursor:auto}.filter-input-container{margin:0 3px;display:flex;background:var(--color-background);width:163px}.filter-input-container:hover{box-shadow:var(--legacy-focus-ring-inactive-shadow)}.filter-input-container:focus-within,\n.filter-text-filter:not(.filter-text-empty) .filter-input-container{box-shadow:var(--legacy-focus-ring-active-shadow)}.filter-input-clear-button{opacity:70%;height:16px;margin-top:1px;cursor:pointer}.filter-cancel-button{display:block}.filter-text-empty .filter-input-clear-button{display:none}.filter-input-clear-button:hover{opacity:99%}@media (forced-colors: active){.filter-bitset-filter span:hover,\n  .filter-bitset-filter span.selected,\n  .filter-bitset-filter span:active{forced-color-adjust:none;background:Highlight;color:HighlightText}.filter-input-container{forced-color-adjust:none;background:ButtonFace;box-shadow:var(--legacy-focus-ring-inactive-shadow);color:fieldtext}.filter-input-container:hover,\n  .filter-input-container:focus-within,\n  .filter-text-filter:not(.filter-text-empty) .filter-input-container{box-shadow:var(--legacy-focus-ring-active-shadow)}}'};const qo={filter:"Filter",egSmalldUrlacomb:"e.g. `/small[d]+/ url:a.com/b`",sclickToSelectMultipleTypes:"{PH1}Click to select multiple types",allStrings:"All",clearFilter:"Clear input"},Go=t.i18n.registerUIStrings("ui/legacy/FilterBar.ts",qo),Xo=t.i18n.getLocalizedString.bind(void 0,Go);class Yo extends(e.ObjectWrapper.eventMixin(Vt)){enabled;stateSetting;filterButtonInternal;filters;alwaysShowFilters;showingWidget;constructor(t,i){super(),this.registerRequiredCSS(jo),this.enabled=!0,this.element.classList.add("filter-bar"),this.stateSetting=e.Settings.Settings.instance().createSetting("filterBar-"+t+"-toggled",Boolean(i)),this.filterButtonInternal=new On(this.stateSetting,"filter",Xo(qo.filter),"filter-filled"),this.filters=[],this.updateFilterBar(),this.stateSetting.addChangeListener(this.updateFilterBar.bind(this))}filterButton(){return this.filterButtonInternal}addFilter(e){this.filters.push(e),this.element.appendChild(e.element()),e.addEventListener("FilterChanged",this.filterChanged,this),this.updateFilterButton()}setEnabled(e){this.enabled=e,this.filterButtonInternal.setEnabled(e),this.updateFilterBar()}forceShowFilterBar(){this.alwaysShowFilters=!0,this.updateFilterBar()}showOnce(){this.stateSetting.set(!0)}filterChanged(){this.updateFilterButton(),this.dispatchEventToListeners("Changed")}wasShown(){super.wasShown(),this.updateFilterBar()}updateFilterBar(){this.parentWidget()&&!this.showingWidget&&(this.visible()?(this.showingWidget=!0,this.showWidget(),this.showingWidget=!1):this.hideWidget())}focus(){for(let e=0;e<this.filters.length;++e)if(this.filters[e]instanceof $o){this.filters[e].focus();break}}updateFilterButton(){let e=!1;for(const t of this.filters)e=e||t.isActive();this.filterButtonInternal.setDefaultWithRedColor(e),this.filterButtonInternal.setToggleWithRedColor(e)}clear(){this.element.removeChildren(),this.filters=[],this.updateFilterButton()}setting(){return this.stateSetting}visible(){return this.alwaysShowFilters||this.stateSetting.get()&&this.enabled}}class $o extends e.ObjectWrapper.ObjectWrapper{filterElement;filterInputElement;prompt;proxyElement;suggestionProvider;constructor(){super(),this.filterElement=document.createElement("div"),this.filterElement.className="filter-text-filter";const e=this.filterElement.createChild("div","filter-input-container");this.filterInputElement=e.createChild("span","filter-input-field"),this.prompt=new vn,this.prompt.initialize(this.completions.bind(this)," ",!0),this.proxyElement=this.prompt.attach(this.filterInputElement),ii.install(this.proxyElement,Xo(qo.egSmalldUrlacomb)),this.prompt.setPlaceholder(Xo(qo.filter)),this.prompt.addEventListener(xn.TextChanged,this.valueChanged.bind(this)),this.suggestionProvider=null;const t=e.createChild("div","filter-input-clear-button");ii.install(t,Xo(qo.clearFilter));const i=new a.Icon.Icon;i.data={color:"var(--icon-default)",width:"16px",height:"16px",iconName:"cross-circle-filled"},i.classList.add("filter-cancel-button"),t.appendChild(i),t.addEventListener("click",(()=>{this.clear(),this.focus()})),this.updateEmptyStyles()}completions(e,t,i){return this.suggestionProvider?this.suggestionProvider(e,t,i):Promise.resolve([])}isActive(){return Boolean(this.prompt.text())}element(){return this.filterElement}value(){return this.prompt.textWithCurrentSuggestion()}setValue(e){this.prompt.setText(e),this.valueChanged()}focus(){this.filterInputElement.focus()}setSuggestionProvider(e){this.prompt.clearAutocomplete(),this.suggestionProvider=e}valueChanged(){this.dispatchEventToListeners("FilterChanged"),this.updateEmptyStyles()}updateEmptyStyles(){this.filterElement.classList.toggle("filter-text-empty",!this.prompt.text())}clear(){this.setValue("")}}class Qo extends e.ObjectWrapper.ObjectWrapper{filtersElement;typeFilterElementTypeNames;allowedTypes;typeFilterElements;setting;constructor(e,t){super(),this.filtersElement=document.createElement("div"),this.filtersElement.classList.add("filter-bitset-filter"),Q(this.filtersElement),Z(this.filtersElement),ii.install(this.filtersElement,Xo(qo.sclickToSelectMultipleTypes,{PH1:Ge.shortcutToString("",Xe.CtrlOrMeta)})),this.typeFilterElementTypeNames=new WeakMap,this.allowedTypes=new Set,this.typeFilterElements=[],this.addBit(Qo.ALL_TYPES,Xo(qo.allStrings)),this.typeFilterElements[0].tabIndex=0,this.filtersElement.createChild("div","filter-bitset-filter-divider");for(let t=0;t<e.length;++t)this.addBit(e[t].name,e[t].label(),e[t].title);t?(this.setting=t,t.addChangeListener(this.settingChanged.bind(this)),this.settingChanged()):this.toggleTypeFilter(Qo.ALL_TYPES,!1)}reset(){this.toggleTypeFilter(Qo.ALL_TYPES,!1)}isActive(){return!this.allowedTypes.has(Qo.ALL_TYPES)}element(){return this.filtersElement}accept(e){return this.allowedTypes.has(Qo.ALL_TYPES)||this.allowedTypes.has(e)}settingChanged(){const e=this.setting.get();this.allowedTypes=new Set;for(const t of this.typeFilterElements){const i=this.typeFilterElementTypeNames.get(t);i&&e[i]&&this.allowedTypes.add(i)}this.update()}update(){(0===this.allowedTypes.size||this.allowedTypes.has(Qo.ALL_TYPES))&&(this.allowedTypes=new Set,this.allowedTypes.add(Qo.ALL_TYPES));for(const e of this.typeFilterElements){const t=this.typeFilterElementTypeNames.get(e),i=this.allowedTypes.has(t||"");e.classList.toggle("selected",i),ue(e,i)}this.dispatchEventToListeners("FilterChanged")}addBit(e,t,i){const n=this.filtersElement.createChild("span",e);n.tabIndex=-1,this.typeFilterElementTypeNames.set(n,e),Es(n,t),J(n),i&&(n.title=i),n.addEventListener("click",this.onTypeFilterClicked.bind(this),!1),n.addEventListener("keydown",this.onTypeFilterKeydown.bind(this),!1),this.typeFilterElements.push(n)}onTypeFilterClicked(e){const t=e;let i;if(i=s.Platform.isMac()?t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.shiftKey:t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.shiftKey,t.target){const e=t.target,n=this.typeFilterElementTypeNames.get(e);this.toggleTypeFilter(n,i)}}onTypeFilterKeydown(e){const t=e,i=t.target;i&&("ArrowLeft"===t.key||"ArrowUp"===t.key?this.keyFocusNextBit(i,!0)&&t.consume(!0):"ArrowRight"===t.key||"ArrowDown"===t.key?this.keyFocusNextBit(i,!1)&&t.consume(!0):n.KeyboardUtilities.isEnterOrSpaceKey(t)&&this.onTypeFilterClicked(t))}keyFocusNextBit(e,t){const i=this.typeFilterElements.indexOf(e);if(-1===i)return!1;const n=t?i-1:i+1;if(n<0||n>=this.typeFilterElements.length)return!1;const s=this.typeFilterElements[n];return s.tabIndex=0,e.tabIndex=-1,s.focus(),!0}toggleTypeFilter(e,t){if(t&&e!==Qo.ALL_TYPES?this.allowedTypes.delete(Qo.ALL_TYPES):this.allowedTypes=new Set,this.allowedTypes.has(e)?this.allowedTypes.delete(e):this.allowedTypes.add(e),this.setting){const e={};for(const t of this.allowedTypes)e[t]=!0;this.setting.set(e)}else this.update()}static ALL_TYPES="all"}class Zo extends e.ObjectWrapper.ObjectWrapper{filterElement;activeWhenChecked;label;checkboxElement;constructor(e,t,i,n){super(),this.filterElement=document.createElement("div"),this.filterElement.classList.add("filter-checkbox-filter"),this.activeWhenChecked=Boolean(i),this.label=ys.create(t),this.filterElement.appendChild(this.label),this.checkboxElement=this.label.checkboxElement,n?nn(this.checkboxElement,n):this.checkboxElement.checked=!0,this.checkboxElement.addEventListener("change",this.fireUpdated.bind(this),!1)}isActive(){return this.activeWhenChecked===this.checkboxElement.checked}checked(){return this.checkboxElement.checked}setChecked(e){this.checkboxElement.checked=e}element(){return this.filterElement}labelElement(){return this.label}fireUpdated(){this.dispatchEventToListeners("FilterChanged")}}var Jo=Object.freeze({__proto__:null,FilterBar:Yo,TextFilterUI:$o,NamedBitSetFilterUI:Qo,CheckboxFilterUI:Zo});var er=Object.freeze({__proto__:null,FilterSuggestionBuilder:class{keys;valueSorter;valuesMap;constructor(e,t){this.keys=e,this.valueSorter=t||((e,t)=>t.sort()),this.valuesMap=new Map}completions(e,t,i){if(!t&&!i)return Promise.resolve([]);const s=t.startsWith("-");s&&(t=t.substring(1));const o=s?"-":"",r=t.indexOf(":"),a=[];if(-1===r){const e=new RegExp("^"+n.StringUtilities.escapeForRegExp(t),"i");for(const t of this.keys)e.test(t)&&a.push({text:o+t+":"})}else{const e=t.substring(0,r).toLowerCase(),i=t.substring(r+1),s=new RegExp("^"+n.StringUtilities.escapeForRegExp(i),"i"),l=Array.from(this.valuesMap.get(e)||new Set);this.valueSorter(e,l);for(const t of l)s.test(t)&&t!==i&&a.push({text:o+e+":"+t})}return Promise.resolve(a)}addItem(e,t){if(!t)return;let i=this.valuesMap.get(e);i||(i=new Set,this.valuesMap.set(e,i)),i.add(t)}clear(){this.valuesMap.clear()}}});class tr{constructor(){s.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(s.InspectorFrontendHostAPI.Events.KeyEventUnhandled,this.onKeyEventUnhandled,this)}async onKeyEventUnhandled(e){const{type:t,key:i,keyCode:n,modifiers:s}=e.data;if("keydown"!==t)return;const o=p.instance(),r=eo.instance();o.setFlavor(io,io.instance),await r.handleKey(Ge.makeKey(n,s),i),o.setFlavor(io,null)}}new tr;var ir=Object.freeze({__proto__:null,ForwardedInputEventHandler:tr});let nr=null;class sr extends HTMLInputElement{history;historyPosition;constructor(){super(),this.history=[""],this.historyPosition=0,this.addEventListener("keydown",this.onKeyDown.bind(this),!1),this.addEventListener("input",this.onInput.bind(this),!1)}static create(){return nr||(nr=o.registerCustomElement("input","history-input",sr)),nr()}onInput(e){this.history.length===this.historyPosition+1&&(this.history[this.history.length-1]=this.value)}onKeyDown(e){const t=e;t.keyCode===ot.Up.code?(this.historyPosition=Math.max(this.historyPosition-1,0),this.value=this.history[this.historyPosition],this.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),t.consume(!0)):t.keyCode===ot.Down.code?(this.historyPosition=Math.min(this.historyPosition+1,this.history.length-1),this.value=this.history[this.historyPosition],this.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),t.consume(!0)):t.keyCode===ot.Enter.code&&this.saveToHistory()}saveToHistory(){this.history.length>1&&this.history[this.history.length-2]===this.value||(this.history[this.history.length-1]=this.value,this.historyPosition=this.history.length-1,this.history.push(""))}}var or=Object.freeze({__proto__:null,HistoryInput:sr});let rr=null;class ar{focusRestorer;static startEditing(e,t){return rr||(rr=new ar),rr.startEditing(e,t)}editorContent(e){const t=e.element;return"INPUT"===t.tagName&&"text"===t.type?t.value:t.textContent||""}setUpEditor(e){const t=e.element;t.classList.add("editing"),t.setAttribute("contenteditable","plaintext-only");const i=t.getAttribute("role");K(t),e.oldRole=i;const n=t.getAttribute("tabIndex");("number"!=typeof n||n<0)&&(t.tabIndex=0),this.focusRestorer=new cs(t),e.oldTabIndex=n}closeEditor(e){const t=e.element;t.classList.remove("editing"),t.removeAttribute("contenteditable"),"string"!=typeof e.oldRole?t.removeAttribute("role"):t.setAttribute("role",e.oldRole),"number"!=typeof e.oldTabIndex?t.removeAttribute("tabIndex"):t.setAttribute("tabIndex",e.oldTabIndex),t.scrollTop=0,t.scrollLeft=0}cancelEditing(e){const t=e.element;"INPUT"===t.tagName&&"text"===t.type?t.value=e.oldText||"":t.textContent=e.oldText}startEditing(e,t){if(!ts(e,!0))return null;const i=t||new lr((function(){}),(function(){})),s={element:e,config:i,oldRole:null,oldTabIndex:null,oldText:null},o=i.commitHandler,r=i.cancelHandler,a=i.pasteHandler,l=i.context;let h="";const d=this;function c(t){i.blurHandler&&!i.blurHandler(e,t)||p.call(e)}function u(){ts(e,!1),e.removeEventListener("blur",c,!1),e.removeEventListener("keydown",f,!0),a&&e.removeEventListener("paste",b,!0),d.focusRestorer&&d.focusRestorer.restore(),d.closeEditor(s)}function m(){d.cancelEditing(s),u(),r(this,l)}function p(){u(),o(this,d.editorContent(s),s.oldText||"",l,h)}function g(t,i){"commit"===t?(p.call(e),i.consume(!0)):"cancel"===t?(m.call(e),i.consume(!0)):t&&t.startsWith("move-")&&(h=t.substring(5),"Tab"===i.key&&i.consume(!0),c())}function b(e){if(!a)return;g(a(e),e)}function f(e){let t=function(e){return"Enter"===e.key?"commit":e.keyCode===ot.Esc.code||e.key===n.KeyboardUtilities.ESCAPE_KEY?"cancel":"Tab"===e.key?"move-"+(e.shiftKey?"backward":"forward"):""}(e);if(!t&&i.postKeydownFinishHandler){const n=i.postKeydownFinishHandler(e);n&&(t=n)}g(t,e)}this.setUpEditor(s),s.oldText=this.editorContent(s),e.addEventListener("blur",c,!1),e.addEventListener("keydown",f,!0),void 0!==a&&e.addEventListener("paste",b,!0);return{cancel:m.bind(e),commit:p.bind(e)}}}class lr{commitHandler;cancelHandler;context;blurHandler;pasteHandler;postKeydownFinishHandler;constructor(e,t,i,n){this.commitHandler=e,this.cancelHandler=t,this.context=i,this.blurHandler=n}setPasteHandler(e){this.pasteHandler=e}setPostKeydownFinishHandler(e){this.postKeydownFinishHandler=e}}var hr=Object.freeze({__proto__:null,InplaceEditor:ar,Config:lr}),dr={cssContent:".list{flex:auto 0 1;overflow-y:auto;border:1px solid var(--color-details-hairline);flex-direction:column;--override-background-list-item-color:hsl(0deg 0% 96%)}.-theme-with-dark-background .list,\n:host-context(.-theme-with-dark-background) .list{--override-background-list-item-color:hsl(0deg 0% 16%)}.list-separator{background:var(--color-background-elevation-1);height:1px}.list-item{flex:none;min-height:30px;display:flex;align-items:center;position:relative;overflow:hidden}.list-item:focus-within,\n.list-item:hover{background:var(--override-background-list-item-color)}.list-widget-input-validation-error{color:var(--legacy-input-validation-error);margin:0 5px}.controls-container{display:flex;flex-direction:row;justify-content:flex-end;align-items:stretch;pointer-events:none}.controls-gradient{flex:0 1 50px}.list-item:focus-within .controls-gradient,\n.list-item:hover .controls-gradient{background-image:linear-gradient(90deg,transparent,var(--override-background-list-item-color))}.controls-buttons{flex:none;display:flex;flex-direction:row;align-items:center;pointer-events:auto;visibility:hidden}.list-item:focus-within .controls-buttons,\n.list-item:hover .controls-buttons{background-color:var(--override-background-list-item-color);visibility:visible}.editor-container{display:flex;flex-direction:column;align-items:stretch;flex:none;background:var(--color-background-elevation-2);overflow:hidden}.editor-content{flex:auto;display:flex;flex-direction:column;align-items:stretch}.editor-buttons{flex:none;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;padding:5px}.editor-buttons > button{flex:none;margin-right:10px}.editor-content input{margin-right:10px}.editor-content input.error-input{background-color:var(--color-background)}.text-prompt-container{padding:3px 6px;height:24px;border:none;box-shadow:var(--legacy-focus-ring-inactive-shadow);border-radius:2px;width:100%;background-color:var(--color-background)}.text-prompt-container:focus{box-shadow:var(--legacy-focus-ring-active-shadow)}.text-prompt-container .text-prompt{width:100%}@media (forced-colors: active){.list-item:focus-within .controls-buttons,\n  .list-item:hover .controls-buttons{background-color:canvas}.list-item:focus-within,\n  .list-item:hover{forced-color-adjust:none;background:Highlight}.list-item:focus-within *,\n  .list-item:hover *{color:HighlightText}.list-item:focus-within .controls-gradient,\n  .list-item:hover .controls-gradient{background-image:unset}}"};const cr={editString:"Edit",removeString:"Remove",saveString:"Save",addString:"Add",cancelString:"Cancel"},ur=t.i18n.registerUIStrings("ui/legacy/ListWidget.ts",cr),mr=t.i18n.getLocalizedString.bind(void 0,ur);var pr=Object.freeze({__proto__:null,ListWidget:class extends _t{delegate;list;lastSeparator;focusRestorer;items;editable;elements;editor;editItem;editElement;emptyPlaceholder;constructor(e,t=!0){super(!0,t),this.registerRequiredCSS(dr),this.delegate=e,this.list=this.contentElement.createChild("div","list"),this.lastSeparator=!1,this.focusRestorer=null,this.items=[],this.editable=[],this.elements=[],this.editor=null,this.editItem=null,this.editElement=null,this.emptyPlaceholder=null,this.updatePlaceholder()}clear(){this.items=[],this.editable=[],this.elements=[],this.lastSeparator=!1,this.list.removeChildren(),this.updatePlaceholder(),this.stopEditing()}appendItem(e,t){if(this.lastSeparator&&this.items.length){const e=document.createElement("div");e.classList.add("list-separator"),this.list.appendChild(e)}this.lastSeparator=!1,this.items.push(e),this.editable.push(t);const i=this.list.createChild("div","list-item");i.appendChild(this.delegate.renderItem(e,t)),t&&(i.classList.add("editable"),i.tabIndex=0,i.appendChild(this.createControls(e,i))),this.elements.push(i),this.updatePlaceholder()}appendSeparator(){this.lastSeparator=!0}removeItem(e){this.editItem===this.items[e]&&this.stopEditing();const t=this.elements[e],i=t.previousElementSibling,n=i&&i.classList.contains("list-separator"),s=t.nextElementSibling,o=s&&s.classList.contains("list-separator");!n||!o&&s||i.remove(),o&&!i&&s.remove(),t.remove(),this.elements.splice(e,1),this.items.splice(e,1),this.editable.splice(e,1),this.updatePlaceholder()}addNewItem(e,t){this.startEditing(t,null,this.elements[e]||null)}setEmptyPlaceholder(e){this.emptyPlaceholder=e,this.updatePlaceholder()}createControls(e,t){const i=document.createElement("div");i.classList.add("controls-container"),i.classList.add("fill"),i.createChild("div","controls-gradient");const n=i.createChild("div","controls-buttons"),s=new kn("",n),o=new Pn(mr(cr.editString),"edit");o.addEventListener(Pn.Events.Click,function(){const i=this.elements.indexOf(t),n=this.elements[i+1]||null;this.startEditing(e,t,n)}.bind(this)),s.appendToolbarItem(o);const r=new Pn(mr(cr.removeString),"bin");return r.addEventListener(Pn.Events.Click,function(){const e=this.elements.indexOf(t);this.element.focus(),this.delegate.removeItemRequested(this.items[e],e)}.bind(this)),s.appendToolbarItem(r),i}wasShown(){super.wasShown(),this.stopEditing()}updatePlaceholder(){this.emptyPlaceholder&&(this.elements.length||this.editor?this.emptyPlaceholder.remove():this.list.appendChild(this.emptyPlaceholder))}startEditing(e,t,i){if(t&&this.editElement===t)return;this.stopEditing(),this.focusRestorer=new cs(this.element),this.list.classList.add("list-editing"),this.element.classList.add("list-editing"),this.editItem=e,this.editElement=t,t&&t.classList.add("hidden");const n=t?this.elements.indexOf(t):-1;this.editor=this.delegate.beginEdit(e),this.updatePlaceholder(),this.list.insertBefore(this.editor.element,i),this.editor.beginEdit(e,n,mr(t?cr.saveString:cr.addString),this.commitEditing.bind(this),this.stopEditing.bind(this))}commitEditing(){const e=this.editItem,t=!this.editElement,i=this.editor;this.stopEditing(),e&&this.delegate.commitEdit(e,i,t)}stopEditing(){this.list.classList.remove("list-editing"),this.element.classList.remove("list-editing"),this.focusRestorer&&this.focusRestorer.restore(),this.editElement&&this.editElement.classList.remove("hidden"),this.editor&&this.editor.element.parentElement&&this.editor.element.remove(),this.editor=null,this.editItem=null,this.editElement=null,this.updatePlaceholder()}},Editor:class{element;contentElementInternal;commitButton;cancelButton;errorMessageContainer;controls;controlByName;validators;commit;cancel;item;index;constructor(){this.element=document.createElement("div"),this.element.classList.add("editor-container"),this.element.addEventListener("keydown",t.bind(null,n.KeyboardUtilities.isEscKey,this.cancelClicked.bind(this)),!1),this.contentElementInternal=this.element.createChild("div","editor-content"),this.contentElementInternal.addEventListener("keydown",t.bind(null,(e=>"Enter"===e.key),this.commitClicked.bind(this)),!1);const e=this.element.createChild("div","editor-buttons");function t(e,t,i){e(i)&&(i.consume(!0),t())}this.commitButton=Is("",this.commitClicked.bind(this),"",!0),e.appendChild(this.commitButton),this.cancelButton=Is(mr(cr.cancelString),this.cancelClicked.bind(this),"",!0),e.appendChild(this.cancelButton),this.errorMessageContainer=this.element.createChild("div","list-widget-input-validation-error"),O(this.errorMessageContainer),this.controls=[],this.controlByName=new Map,this.validators=[],this.commit=null,this.cancel=null,this.item=null,this.index=-1}contentElement(){return this.contentElementInternal}createInput(e,t,i,n){const s=Ss("",t);return s.placeholder=i,s.addEventListener("input",this.validateControls.bind(this,!1),!1),s.addEventListener("blur",this.validateControls.bind(this,!1),!1),be(s,i),this.controlByName.set(e,s),this.controls.push(s),this.validators.push(n),s}createSelect(e,t,i,n){const s=document.createElement("select");s.classList.add("chrome-select");for(let e=0;e<t.length;++e){const i=s.createChild("option");i.value=t[e],i.textContent=t[e]}return n&&(ii.install(s,n),be(s,n)),s.addEventListener("input",this.validateControls.bind(this,!1),!1),s.addEventListener("blur",this.validateControls.bind(this,!1),!1),this.controlByName.set(e,s),this.controls.push(s),this.validators.push(i),s}createCustomControl(e,t,i){const n=new t;return this.controlByName.set(e,n),this.controls.push(n),this.validators.push(i),n}control(e){const t=this.controlByName.get(e);if(!t)throw new Error(`Control with name ${e} does not exist, please verify.`);return t}validateControls(e){let t=!0;this.errorMessageContainer.textContent="";for(let i=0;i<this.controls.length;++i){const n=this.controls[i],{valid:s,errorMessage:o}=this.validators[i].call(null,this.item,this.index,n);n.classList.toggle("error-input",!s&&!e),pe(n,!s&&!e),e||!o||this.errorMessageContainer.textContent||(this.errorMessageContainer.textContent=o),t=t&&s}this.commitButton.disabled=!t}requestValidation(){this.validateControls(!1)}beginEdit(e,t,i,n,s){this.commit=n,this.cancel=s,this.item=e,this.index=t,this.commitButton.textContent=i,this.element.scrollIntoViewIfNeeded(!1),this.controls.length&&this.controls[0].focus(),this.validateControls(!0)}commitClicked(){if(this.commitButton.disabled)return;const e=this.commit;this.commit=null,this.cancel=null,this.item=null,this.index=-1,e&&e()}cancelClicked(){const e=this.cancel;this.commit=null,this.cancel=null,this.item=null,this.index=-1,e&&e()}}});class gr extends _t{panelName;constructor(e){super(),this.element.classList.add("panel"),this.element.setAttribute("aria-label",e),this.element.classList.add(e),this.panelName=e,self.UI=self.UI||{},self.UI.panels=self.UI.panels||{},UI.panels[e]=this}get name(){return this.panelName}searchableView(){return null}elementsToRestoreScrollPositionsFor(){return[]}}var br=Object.freeze({__proto__:null,Panel:gr,PanelWithSidebar:class extends gr{panelSplitWidget;mainWidget;sidebarWidget;constructor(e,t){super(e),this.panelSplitWidget=new Zt(!0,!1,this.panelName+"PanelSplitViewState",t||200),this.panelSplitWidget.show(this.element),this.mainWidget=new _t,this.panelSplitWidget.setMainWidget(this.mainWidget),this.sidebarWidget=new _t,this.sidebarWidget.setMinimumSize(100,25),this.panelSplitWidget.setSidebarWidget(this.sidebarWidget),this.sidebarWidget.element.classList.add("panel-sidebar")}panelSidebarElement(){return this.sidebarWidget.element}mainElement(){return this.mainWidget.element}splitWidget(){return this.panelSplitWidget}}}),fr={cssContent:".widget{display:flex;background:var(--color-background);border:1px solid transparent;box-shadow:var(--drop-shadow);border-radius:2px;overflow:auto;user-select:text;line-height:11px}.widget.has-padding{padding:6px}"};let vr=null;var wr=Object.freeze({__proto__:null,PopoverHelper:class{disableOnClick;hasPadding;getRequest;scheduledRequest;hidePopoverCallback;container;showTimeout;hideTimeout;hidePopoverTimer;showPopoverTimer;boundMouseDown;boundMouseMove;boundMouseOut;constructor(e,t){this.disableOnClick=!1,this.hasPadding=!1,this.getRequest=t,this.scheduledRequest=null,this.hidePopoverCallback=null,this.container=e,this.showTimeout=0,this.hideTimeout=0,this.hidePopoverTimer=null,this.showPopoverTimer=null,this.boundMouseDown=this.mouseDown.bind(this),this.boundMouseMove=this.mouseMove.bind(this),this.boundMouseOut=this.mouseOut.bind(this),this.container.addEventListener("mousedown",this.boundMouseDown,!1),this.container.addEventListener("mousemove",this.boundMouseMove,!1),this.container.addEventListener("mouseout",this.boundMouseOut,!1),this.setTimeout(1e3)}setTimeout(e,t){this.showTimeout=e,this.hideTimeout="number"==typeof t?t:e/2}setHasPadding(e){this.hasPadding=e}setDisableOnClick(e){this.disableOnClick=e}eventInScheduledContent(e){const t=e;return!!this.scheduledRequest&&this.scheduledRequest.box.contains(t.clientX,t.clientY)}mouseDown(e){this.disableOnClick?this.hidePopover():this.eventInScheduledContent(e)||(this.startHidePopoverTimer(0),this.stopShowPopoverTimer(),this.startShowPopoverTimer(e,0))}mouseMove(e){const t=e;if(this.eventInScheduledContent(t))return this.stopShowPopoverTimer(),void this.startShowPopoverTimer(t,this.isPopoverVisible()?.6*this.showTimeout:this.showTimeout);this.startHidePopoverTimer(this.hideTimeout),this.stopShowPopoverTimer(),t.which&&this.disableOnClick||this.startShowPopoverTimer(t,this.isPopoverVisible()?.6*this.showTimeout:this.showTimeout)}popoverMouseMove(e){this.stopHidePopoverTimer()}popoverMouseOut(e,t){const i=t;if(!e.isShowing())return;const n=i.relatedTarget;n&&!n.isSelfOrDescendant(e.contentElement)&&this.startHidePopoverTimer(this.hideTimeout)}mouseOut(e){this.isPopoverVisible()&&(this.eventInScheduledContent(e)||this.startHidePopoverTimer(this.hideTimeout))}startHidePopoverTimer(e){this.hidePopoverCallback&&!this.hidePopoverTimer&&(this.hidePopoverTimer=window.setTimeout((()=>{this.hidePopoverInternal(),this.hidePopoverTimer=null}),e))}startShowPopoverTimer(e,t){this.scheduledRequest=this.getRequest.call(null,e),this.scheduledRequest&&(this.showPopoverTimer=window.setTimeout((()=>{this.showPopoverTimer=null,this.stopHidePopoverTimer(),this.hidePopoverInternal();const t=e.target.ownerDocument;this.showPopover(t)}),t))}stopShowPopoverTimer(){this.showPopoverTimer&&(clearTimeout(this.showPopoverTimer),this.showPopoverTimer=null)}isPopoverVisible(){return Boolean(this.hidePopoverCallback)}hidePopover(){this.stopShowPopoverTimer(),this.hidePopoverInternal()}hidePopoverInternal(){this.hidePopoverCallback&&(this.hidePopoverCallback.call(null),this.hidePopoverCallback=null)}showPopover(e){const t=new Ks;t.registerRequiredCSS(fr),t.setSizeBehavior("MeasureContent"),t.setMarginBehavior("Arrow");const i=this.scheduledRequest;i&&i.show.call(null,t).then((n=>{n&&(this.scheduledRequest===i?(vr&&(console.error("One popover is already visible"),vr.hidePopover()),vr=this,t.contentElement.classList.toggle("has-padding",this.hasPadding),t.contentElement.addEventListener("mousemove",this.popoverMouseMove.bind(this),!0),t.contentElement.addEventListener("mouseout",this.popoverMouseOut.bind(this,t),!0),t.setContentAnchorBox(i.box),t.show(e),this.hidePopoverCallback=()=>{i.hide&&i.hide.call(null),t.hide(),vr=null}):i.hide&&i.hide.call(null))}))}stopHidePopoverTimer(){this.hidePopoverTimer&&(clearTimeout(this.hidePopoverTimer),this.hidePopoverTimer=null,this.stopShowPopoverTimer())}dispose(){this.container.removeEventListener("mousedown",this.boundMouseDown,!1),this.container.removeEventListener("mousemove",this.boundMouseMove,!1),this.container.removeEventListener("mouseout",this.boundMouseOut,!1)}}}),xr={cssContent:".progress-indicator-shadow-stop-button{background-color:var(--color-accent-red);border:0;width:10px;height:12px;border-radius:2px}.progress-indicator-shadow-container{display:flex;flex:1 0 auto;align-items:center}.progress-indicator-shadow-container .title{text-overflow:ellipsis;overflow:hidden;max-width:150px;margin-right:2px;color:var(--color-text-secondary)}.progress-indicator-shadow-container progress{flex:auto;margin:0 2px;width:100px}"};var Er=Object.freeze({__proto__:null,ProgressIndicator:class{element;shadowRoot;contentElement;labelElement;progressElement;stopButton;isCanceledInternal;worked;isDone;constructor(){this.element=document.createElement("div"),this.element.classList.add("progress-indicator"),this.shadowRoot=o.createShadowRootWithCoreStyles(this.element,{cssFile:xr,delegatesFocus:void 0}),this.contentElement=this.shadowRoot.createChild("div","progress-indicator-shadow-container"),this.labelElement=this.contentElement.createChild("div","title"),this.progressElement=this.contentElement.createChild("progress"),this.progressElement.value=0,this.stopButton=this.contentElement.createChild("button","progress-indicator-shadow-stop-button"),this.stopButton.addEventListener("click",this.cancel.bind(this)),this.isCanceledInternal=!1,this.worked=0}show(e){e.appendChild(this.element)}done(){this.isDone||(this.isDone=!0,this.element.remove())}cancel(){this.isCanceledInternal=!0}isCanceled(){return this.isCanceledInternal}setTitle(e){this.labelElement.textContent=e}setTotalWork(e){this.progressElement.max=e}setWorked(e,t){this.worked=e,this.progressElement.value=e,t&&this.setTitle(t)}incrementWorked(e){this.setWorked(this.worked+(e||1))}}}),Ir={cssContent:".widget{padding:20px}.message,\n.button{font-size:larger;white-space:pre;margin:5px}.button{text-align:center;margin-top:10px}.reason{--override-reason-color:#8b0000;color:var(--override-reason-color)}.-theme-with-dark-background .reason,\n:host-context(.-theme-with-dark-background) .reason{--override-reason-color:rgb(255 116 116)}"};const Sr={debuggingConnectionWasClosed:"Debugging connection was closed. Reason: ",reconnectWhenReadyByReopening:"Reconnect when ready by reopening DevTools.",reconnectDevtools:"Reconnect `DevTools`"},yr=t.i18n.registerUIStrings("ui/legacy/RemoteDebuggingTerminatedScreen.ts",Sr),Cr=t.i18n.getLocalizedString.bind(void 0,yr);class kr extends _t{constructor(e){super(!0),this.registerRequiredCSS(Ir);const t=this.contentElement.createChild("div","message").createChild("span");t.append(Cr(Sr.debuggingConnectionWasClosed));t.createChild("span","reason").textContent=e,this.contentElement.createChild("div","message").textContent=Cr(Sr.reconnectWhenReadyByReopening);const i=Is(Cr(Sr.reconnectDevtools),(()=>window.location.reload()));this.contentElement.createChild("div","button").appendChild(i)}static show(e){const t=new Qs;t.setSizeBehavior("MeasureContent"),t.addCloseButton(),t.setDimmed(!0),new kr(e).show(t.contentElement),t.show()}}var Tr=Object.freeze({__proto__:null,RemoteDebuggingTerminatedScreen:kr}),Mr={cssContent:":host{background-color:var(--color-background-elevation-1)}.report-content-box{background-color:var(--color-background);overflow:auto}.report-content-box.no-scroll{overflow:visible}.report-header{border-bottom:1px solid var(--color-details-hairline);padding:12px 24px}.report-header .toolbar{margin-bottom:-8px;margin-top:5px;margin-left:-8px}.report-title{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;user-select:text}.report-url,\n.report-subtitle{font-size:12px;margin-top:10px}.report-section{display:flex;padding:12px;border-bottom:1px solid var(--color-details-hairline);flex-direction:column}.report-section-header{margin-left:18px;display:flex;flex-direction:row;align-items:center}.report-section-title{flex:auto;text-overflow:ellipsis;overflow:hidden;font-weight:bold;color:var(--color-text-secondary)}.report-field{margin-top:8px;display:flex;line-height:28px}.report-row{margin:10px 0 2px 18px}.report-field-name{color:var(--color-text-disabled);flex:0 0 128px;text-align:right;padding:0 6px;white-space:pre-wrap}.report-field-value{flex:auto;padding:0 6px;white-space:pre;user-select:text}.report-field-value-is-flexed{display:flex;white-space:pre-wrap}.report-field-value-subtitle{color:var(--color-text-disabled);line-height:14px}.report-row-selectable{user-select:text}.image-wrapper,\n.image-wrapper img{max-width:200px;max-height:200px;display:block}.image-wrapper{height:fit-content;margin-right:8px}.show-mask img{clip-path:circle(40% at 50% 50%)}.show-mask .image-wrapper{background:var(--image-file-checker)}@media (forced-colors: active){.report-field-value .inline-icon{--icon-color:ButtonText}.report-field-value .multiline-value{--icon-color:ButtonText}}"};class Lr extends _t{headerElement;titleElement;fieldList;fieldMap;constructor(e,t){super(),this.element.classList.add("report-section"),t&&this.element.classList.add(t),this.headerElement=this.element.createChild("div","report-section-header"),this.titleElement=this.headerElement.createChild("div","report-section-title"),this.setTitle(e),te(this.titleElement,2),this.fieldList=this.element.createChild("div","vbox"),this.fieldMap=new Map}title(){return this.titleElement.textContent||""}getTitleElement(){return this.titleElement}getFieldElement(){return this.fieldList}appendFieldWithCustomView(e){this.fieldList.append(e)}setTitle(e,t){this.titleElement.textContent!==e&&(this.titleElement.textContent=e),ii.install(this.titleElement,t||""),this.titleElement.classList.toggle("hidden",!this.titleElement.textContent)}setUiGroupTitle(e){F(this.element),be(this.element,e)}createToolbar(){const e=new kn("");return this.headerElement.appendChild(e.element),e}appendField(e,t){let i=this.fieldMap.get(e);return i||(i=this.fieldList.createChild("div","report-field"),i.createChild("div","report-field-name").textContent=e,this.fieldMap.set(e,i),i.createChild("div","report-field-value")),t&&i.lastElementChild&&(i.lastElementChild.textContent=t),i.lastElementChild}appendFlexedField(e,t){const i=this.appendField(e,t);return i.classList.add("report-field-value-is-flexed"),i}removeField(e){const t=this.fieldMap.get(e);t&&t.remove(),this.fieldMap.delete(e)}setFieldVisible(e,t){const i=this.fieldMap.get(e);i&&i.classList.toggle("hidden",!t)}fieldValue(e){const t=this.fieldMap.get(e);return t?t.lastElementChild:null}appendRow(){return this.fieldList.createChild("div","report-row")}appendSelectableRow(){return this.fieldList.createChild("div","report-row report-row-selectable")}clearContent(){this.fieldList.removeChildren(),this.fieldMap.clear()}markFieldListAsGroup(){F(this.fieldList),be(this.fieldList,this.title())}setIconMasked(e){this.element.classList.toggle("show-mask",e)}}var Pr=Object.freeze({__proto__:null,ReportView:class extends _t{contentBox;headerElement;titleElement;sectionList;subtitleElement;urlElement;constructor(e){super(!0),this.registerRequiredCSS(Mr),this.contentBox=this.contentElement.createChild("div","report-content-box"),this.headerElement=this.contentBox.createChild("div","report-header vbox"),this.titleElement=this.headerElement.createChild("div","report-title"),e?this.titleElement.textContent=e:this.headerElement.classList.add("hidden"),te(this.titleElement,1),this.sectionList=this.contentBox.createChild("div","vbox")}getHeaderElement(){return this.headerElement}setTitle(e){this.titleElement.textContent!==e&&(this.titleElement.textContent=e,this.headerElement.classList.toggle("hidden",Boolean(e)))}setSubtitle(e){this.subtitleElement&&this.subtitleElement.textContent===e||(this.subtitleElement||(this.subtitleElement=this.headerElement.createChild("div","report-subtitle")),this.subtitleElement.textContent=e)}setURL(e){this.urlElement||(this.urlElement=this.headerElement.createChild("div","report-url link")),this.urlElement.removeChildren(),e&&this.urlElement.appendChild(e)}createToolbar(){const e=new kn("");return this.headerElement.appendChild(e.element),e}appendSection(e,t){const i=new Lr(e,t);return i.show(this.sectionList),i}sortSections(e){const t=this.children().slice();if(!t.every(((t,i,n)=>!i||e(n[i-1],n[i])<=0))){this.detachChildWidgets(),t.sort(e);for(const e of t)e.show(this.sectionList)}}setHeaderVisible(e){this.headerElement.classList.toggle("hidden",!e)}setBodyScrollable(e){this.contentBox.classList.toggle("no-scroll",!e)}},Section:Lr}),Dr={cssContent:".root-view{background-color:var(--color-background);overflow:hidden;position:absolute!important;left:0;top:0;right:0;bottom:0}"};var Rr=Object.freeze({__proto__:null,RootView:class extends _t{window;constructor(){super(),this.markAsRoot(),this.element.classList.add("root-view"),this.registerRequiredCSS(Dr),this.element.setAttribute("spellcheck","false")}attachToDocument(e){e.defaultView&&e.defaultView.addEventListener("resize",this.doResize.bind(this),!1),this.window=e.defaultView,this.doResize(),this.show(e.body)}doResize(){if(this.window){const e=this.constraints().minimum,t=Gt.instance().zoomFactor(),i=Math.min(0,this.window.innerWidth-e.width/t);this.element.style.marginRight=i+"px";const n=Math.min(0,this.window.innerHeight-e.height/t);this.element.style.marginBottom=n+"px"}super.doResize()}}}),Ar={cssContent:".search-bar{flex:0 0 31px;background-color:var(--color-background-elevation-1);border-top:1px solid var(--color-details-hairline);display:flex;overflow:hidden;z-index:0}.search-bar.replaceable{flex:0 0 57px}.search-replace{appearance:none;border:0;padding:0 3px;margin:0;flex:1}.search-replace:focus{outline:none}.toolbar-search{display:flex;width:100%}.toolbar-search > div{margin:2px;flex-shrink:0}.toolbar-search-inputs{flex-grow:1;min-width:150px}.toolbar-search-navigation-controls{align-self:stretch}.toolbar-search-navigation{display:inline-block;width:20px;height:20px;background-repeat:no-repeat;border-left:1px solid var(--color-details-hairline);opacity:30%}.toolbar-search-navigation.enabled{opacity:100%}.toolbar-search button.search-action-button{font-weight:400;height:22px;width:87px}.toolbar-search-control{display:flex;position:relative;background-color:var(--color-background)}.toolbar-search-buttons{display:flex;flex-direction:column}.toolbar-replace-control,\n#search-input-field{line-height:17px}.toolbar-search-control,\n.toolbar-replace-control{border:1px solid var(--color-details-hairline);height:22px;border-radius:2px;width:100%;margin-top:2px;margin-bottom:2px}.toolbar-search-navigation.enabled:active{background-position:4px 7px,0 0}.toolbar-search-navigation.toolbar-search-navigation-prev{background-image:var(--image-file-chevron-up);border-left:1px solid var(--color-details-hairline)}:host-context(.-theme-with-dark-background) .toolbar-search-navigation{filter:invert(90%)}.toolbar-search-navigation.toolbar-search-navigation-prev.enabled:active{background-image:var(--image-file-chevron-up),var(--color-background-elevation-1)}.toolbar-search-navigation.toolbar-search-navigation-next{background-image:var(--image-file-chevron-down);border-left:1px solid var(--color-details-hairline)}.toolbar-search-navigation.toolbar-search-navigation-next.enabled:active{background-image:var(--image-file-chevron-down),var(--color-background-elevation-1)}.search-results-matches{display:inline-block;text-align:right;padding:0 4px;color:var(--color-text-secondary);align-self:center}.first-row-buttons{display:flex;justify-content:space-between}.toolbar-search > .replace-toggle-toolbar{margin:2px -2px 0 0}.toolbar-search-options{margin:0 auto}:host-context(#sources-panel-sources-view) .search-bar{flex-basis:auto}:host-context(#sources-panel-sources-view) .toolbar-search{flex-wrap:wrap}"};const Or={replace:"Replace",findString:"Find",searchPrevious:"Search previous",searchNext:"Search next",matchCase:"Match Case",useRegularExpression:"Use Regular Expression",cancel:"Cancel",replaceAll:"Replace all",dOfD:"{PH1} of {PH2}",matchString:"1 match",dMatches:"{PH1} matches"},Br=t.i18n.registerUIStrings("ui/legacy/SearchableView.ts",Or),Wr=t.i18n.getLocalizedString.bind(void 0,Br);const Fr=Symbol("searchableView"),Hr=new WeakMap;class zr{query;caseSensitive;isRegex;constructor(e,t,i){this.query=e,this.caseSensitive=t,this.isRegex=i}toSearchRegex(e){let t=this.caseSensitive?"":"i";e&&(t+="g");const i=this.isRegex?"/"+this.query+"/":this.query;let s,o=!1;try{/^\/.+\/$/.test(i)&&(s=new RegExp(i.substring(1,i.length-1),t),o=!0)}catch(e){}return s||(s=n.StringUtilities.createPlainTextSearchRegex(i,t)),{regex:s,fromQuery:o}}}var Nr=Object.freeze({__proto__:null,SearchableView:class extends _t{searchProvider;replaceProvider;setting;replaceable;footerElementContainer;footerElement;replaceToggleButton;searchInputElement;matchesElement;searchNavigationPrevElement;searchNavigationNextElement;replaceInputElement;buttonsContainer;caseSensitiveButton;regexButton;secondRowButtons;replaceButtonElement;replaceAllButtonElement;minimalSearchQuerySize;searchIsVisible;currentQuery;valueChangedTimeoutId;constructor(t,i,n){super(!0),this.registerRequiredCSS(Ar),Hr.set(this.element,this),this.searchProvider=t,this.replaceProvider=i,this.setting=n?e.Settings.Settings.instance().createSetting(n,{}):null,this.replaceable=!1,this.contentElement.createChild("slot"),this.footerElementContainer=this.contentElement.createChild("div","search-bar hidden"),this.footerElementContainer.style.order="100",this.footerElement=this.footerElementContainer.createChild("div","toolbar-search");const s=new kn("replace-toggle-toolbar",this.footerElement);this.replaceToggleButton=new Rn(Wr(Or.replace),"replace"),this.replaceToggleButton.addEventListener(Pn.Events.Click,this.toggleReplace,this),s.appendToolbarItem(this.replaceToggleButton);const o=this.footerElement.createChild("div","toolbar-search-inputs"),r=o.createChild("div","toolbar-search-control");this.searchInputElement=sr.create(),this.searchInputElement.type="search",this.searchInputElement.classList.add("search-replace","custom-search-input"),this.searchInputElement.id="search-input-field",this.searchInputElement.placeholder=Wr(Or.findString),r.appendChild(this.searchInputElement),this.matchesElement=r.createChild("label","search-results-matches"),this.matchesElement.setAttribute("for","search-input-field");const a=r.createChild("div","toolbar-search-navigation-controls");this.searchNavigationPrevElement=a.createChild("div","toolbar-search-navigation toolbar-search-navigation-prev"),this.searchNavigationPrevElement.addEventListener("click",this.onPrevButtonSearch.bind(this),!1),ii.install(this.searchNavigationPrevElement,Wr(Or.searchPrevious)),be(this.searchNavigationPrevElement,Wr(Or.searchPrevious)),this.searchNavigationNextElement=a.createChild("div","toolbar-search-navigation toolbar-search-navigation-next"),this.searchNavigationNextElement.addEventListener("click",this.onNextButtonSearch.bind(this),!1),ii.install(this.searchNavigationNextElement,Wr(Or.searchNext)),be(this.searchNavigationNextElement,Wr(Or.searchNext)),this.searchInputElement.addEventListener("keydown",this.onSearchKeyDown.bind(this),!0),this.searchInputElement.addEventListener("input",this.onInput.bind(this),!1),this.replaceInputElement=o.createChild("input","search-replace toolbar-replace-control hidden"),this.replaceInputElement.addEventListener("keydown",this.onReplaceKeyDown.bind(this),!0),this.replaceInputElement.placeholder=Wr(Or.replace),this.buttonsContainer=this.footerElement.createChild("div","toolbar-search-buttons");const l=this.buttonsContainer.createChild("div","first-row-buttons"),h=new kn("toolbar-search-options",l);this.searchProvider.supportsCaseSensitiveSearch()&&(this.caseSensitiveButton=new Rn(Wr(Or.matchCase)),this.caseSensitiveButton.setText("Aa"),this.caseSensitiveButton.addEventListener(Pn.Events.Click,this.toggleCaseSensitiveSearch,this),h.appendToolbarItem(this.caseSensitiveButton)),this.searchProvider.supportsRegexSearch()&&(this.regexButton=new Rn(Wr(Or.useRegularExpression)),this.regexButton.setText(".*"),this.regexButton.addEventListener(Pn.Events.Click,this.toggleRegexSearch,this),h.appendToolbarItem(this.regexButton));const d=Is(Wr(Or.cancel),this.closeSearch.bind(this),"search-action-button");l.appendChild(d),this.secondRowButtons=this.buttonsContainer.createChild("div","second-row-buttons hidden"),this.replaceButtonElement=Is(Wr(Or.replace),this.replace.bind(this),"search-action-button"),this.replaceButtonElement.disabled=!0,this.secondRowButtons.appendChild(this.replaceButtonElement),this.replaceAllButtonElement=Is(Wr(Or.replaceAll),this.replaceAll.bind(this),"search-action-button"),this.secondRowButtons.appendChild(this.replaceAllButtonElement),this.replaceAllButtonElement.disabled=!0,this.minimalSearchQuerySize=3,this.loadSetting()}static fromElement(e){let t=null;for(;e&&!t;)t=Hr.get(e)||null,e=e.parentElementOrShadowHost();return t}toggleCaseSensitiveSearch(){this.caseSensitiveButton&&this.caseSensitiveButton.setToggled(!this.caseSensitiveButton.toggled()),this.saveSetting(),this.performSearch(!1,!0)}toggleRegexSearch(){this.regexButton&&this.regexButton.setToggled(!this.regexButton.toggled()),this.saveSetting(),this.performSearch(!1,!0)}toggleReplace(){this.replaceToggleButton.setToggled(!this.replaceToggleButton.toggled()),this.updateSecondRowVisibility()}saveSetting(){if(!this.setting)return;const e=this.setting.get()||{};this.caseSensitiveButton&&(e.caseSensitive=this.caseSensitiveButton.toggled()),this.regexButton&&(e.isRegex=this.regexButton.toggled()),this.setting.set(e)}loadSetting(){const e=this.setting&&this.setting.get()||{};this.searchProvider.supportsCaseSensitiveSearch()&&this.caseSensitiveButton&&this.caseSensitiveButton.setToggled(Boolean(e.caseSensitive)),this.searchProvider.supportsRegexSearch()&&this.regexButton&&this.regexButton.setToggled(Boolean(e.isRegex))}setMinimalSearchQuerySize(e){this.minimalSearchQuerySize=e}setPlaceholder(e,t){this.searchInputElement.placeholder=e,t&&be(this.searchInputElement,t)}setReplaceable(e){this.replaceable=e}updateSearchMatchesCount(e){const t=this.searchProvider;t.currentSearchMatches!==e&&(t.currentSearchMatches=e,this.updateSearchMatchesCountAndCurrentMatchIndex(t.currentQuery?e:0,-1))}updateCurrentMatchIndex(e){const t=this.searchProvider;this.updateSearchMatchesCountAndCurrentMatchIndex(t.currentSearchMatches,e)}isSearchVisible(){return Boolean(this.searchIsVisible)}closeSearch(){this.cancelSearch(),this.footerElementContainer.hasFocus()&&this.focus(),this.searchProvider.onSearchClosed?.()}toggleSearchBar(e){this.footerElementContainer.classList.toggle("hidden",!e),this.doResize()}cancelSearch(){this.searchIsVisible&&(this.resetSearch(),delete this.searchIsVisible,this.toggleSearchBar(!1))}resetSearch(){this.clearSearch(),this.updateReplaceVisibility(),this.matchesElement.textContent=""}refreshSearch(){this.searchIsVisible&&(this.resetSearch(),this.performSearch(!1,!1))}handleFindNextShortcut(){return!!this.searchIsVisible&&(this.searchProvider.jumpToNextSearchResult(),!0)}handleFindPreviousShortcut(){return!!this.searchIsVisible&&(this.searchProvider.jumpToPreviousSearchResult(),!0)}handleFindShortcut(){return this.showSearchField(),!0}handleCancelSearchShortcut(){return!!this.searchIsVisible&&(this.closeSearch(),!0)}updateSearchNavigationButtonState(e){this.replaceButtonElement.disabled=!e,this.replaceAllButtonElement.disabled=!e,this.searchNavigationPrevElement.classList.toggle("enabled",e),this.searchNavigationNextElement.classList.toggle("enabled",e)}updateSearchMatchesCountAndCurrentMatchIndex(e,t){this.currentQuery?this.matchesElement.textContent=0===e||t>=0?Wr(Or.dOfD,{PH1:t+1,PH2:e}):1===e?Wr(Or.matchString):Wr(Or.dMatches,{PH1:e}):this.matchesElement.textContent="",this.updateSearchNavigationButtonState(e>0)}showSearchField(){let e;if(this.searchIsVisible&&this.cancelSearch(),!this.searchInputElement.hasFocus()){const t=qi.instance().element.window().getSelection();t&&t.rangeCount&&(e=t.toString().replace(/\r?\n.*/,""))}this.toggleSearchBar(!0),this.updateReplaceVisibility(),e&&(this.searchInputElement.value=e),this.performSearch(!1,!1),this.searchInputElement.focus(),this.searchInputElement.select(),this.searchIsVisible=!0}updateReplaceVisibility(){this.replaceToggleButton.setVisible(this.replaceable),this.replaceable||(this.replaceToggleButton.setToggled(!1),this.updateSecondRowVisibility())}onSearchKeyDown(e){const t=e;if(n.KeyboardUtilities.isEscKey(t))return this.closeSearch(),void t.consume(!0);"Enter"===t.key&&(this.currentQuery?this.jumpToNextSearchResult(t.shiftKey):this.performSearch(!0,!0,t.shiftKey))}onReplaceKeyDown(e){"Enter"===e.key&&this.replace()}jumpToNextSearchResult(e){this.currentQuery&&(e?this.searchProvider.jumpToPreviousSearchResult():this.searchProvider.jumpToNextSearchResult())}onNextButtonSearch(e){this.searchNavigationNextElement.classList.contains("enabled")&&(this.jumpToNextSearchResult(),this.searchInputElement.focus())}onPrevButtonSearch(e){this.searchNavigationPrevElement.classList.contains("enabled")&&(this.jumpToNextSearchResult(!0),this.searchInputElement.focus())}clearSearch(){const e=this.searchProvider;delete this.currentQuery,Boolean(e.currentQuery)&&(delete e.currentQuery,this.searchProvider.onSearchCanceled()),this.updateSearchMatchesCountAndCurrentMatchIndex(0,-1)}performSearch(e,t,i){const n=this.searchInputElement.value;if(!n||!e&&n.length<this.minimalSearchQuerySize&&!this.currentQuery)return void this.clearSearch();this.currentQuery=n,this.searchProvider.currentQuery=n;const s=this.currentSearchConfig();this.searchProvider.performSearch(s,t,i)}currentSearchConfig(){const e=this.searchInputElement.value,t=!!this.caseSensitiveButton&&this.caseSensitiveButton.toggled(),i=!!this.regexButton&&this.regexButton.toggled();return new zr(e,t,i)}updateSecondRowVisibility(){const e=this.replaceToggleButton.toggled();this.footerElementContainer.classList.toggle("replaceable",e),this.secondRowButtons.classList.toggle("hidden",!e),this.replaceInputElement.classList.toggle("hidden",!e),e?this.replaceInputElement.focus():this.searchInputElement.focus(),this.doResize()}replace(){if(!this.replaceProvider)throw new Error("No 'replacable' provided to SearchableView!");const e=this.currentSearchConfig();this.replaceProvider.replaceSelectionWith(e,this.replaceInputElement.value),delete this.currentQuery,this.performSearch(!0,!0)}replaceAll(){if(!this.replaceProvider)throw new Error("No 'replacable' provided to SearchableView!");const e=this.currentSearchConfig();this.replaceProvider.replaceAllWith(e,this.replaceInputElement.value)}onInput(t){if(!e.Settings.Settings.instance().moduleSetting("searchAsYouType").get())return void this.clearSearch();this.valueChangedTimeoutId&&clearTimeout(this.valueChangedTimeoutId);const i=this.searchInputElement.value.length<3?200:0;this.valueChangedTimeoutId=window.setTimeout(this.onValueChanged.bind(this),i)}onValueChanged(){this.searchIsVisible&&(delete this.valueChangedTimeoutId,this.performSearch(!1,!0))}},_symbol:Fr,SearchConfig:zr}),_r={cssContent:".item.disabled{opacity:50%}.item-list{background-color:var(--color-background);box-shadow:var(--drop-shadow);overflow-x:hidden;overflow-y:auto;width:100%}.item.highlighted{color:var(--legacy-selection-fg-color);background-color:var(--legacy-selection-bg-color)}@media (forced-colors: active){.item.disabled{opacity:100%}.item-list{border:1px solid ButtonText;background-color:ButtonFace}.item.highlighted{forced-color-adjust:none;color:HighlightText;background-color:Highlight}}"},Vr={cssContent:"button.soft-dropdown{height:26px;text-align:left;position:relative;border:none;background:none}button.soft-dropdown[disabled]{opacity:50%}button.soft-dropdown > .title{padding-right:5px;flex:0 1 120px;overflow:hidden;text-overflow:ellipsis}button.soft-dropdown:hover:not(:active) > .title{color:var(--color-text-primary)}@media (forced-colors: active){button.soft-dropdown{border:1px solid ButtonText;background:ButtonFace;color:ButtonText}button.soft-dropdown[disabled]{opacity:100%}}"};const Ur={noItemSelected:"(no item selected)"},Kr=t.i18n.registerUIStrings("ui/legacy/SoftDropDown.ts",Ur),jr=t.i18n.getLocalizedString.bind(void 0,Kr);var qr=Object.freeze({__proto__:null,SoftDropDown:class{delegate;selectedItem;model;placeholderText;element;titleElement;glassPane;list;rowHeight;width;listWasShowing200msAgo;constructor(e,t){this.delegate=t,this.selectedItem=null,this.model=e,this.placeholderText=jr(Ur.noItemSelected),this.element=document.createElement("button"),this.element.classList.add("soft-dropdown"),c.ThemeSupport.instance().appendStyle(this.element,Vr),this.titleElement=this.element.createChild("span","title");const i=Pe.create("triangle-down");this.element.appendChild(i),re(this.element,!1),this.glassPane=new Ks,this.glassPane.setMarginBehavior("NoMargin"),this.glassPane.setAnchorBehavior("PreferBottom"),this.glassPane.setOutsideClickCallback(this.hide.bind(this)),this.glassPane.setPointerEventsBehavior("BlockedByGlassPane"),this.list=new hn(e,this,an.EqualHeightItems),this.list.element.classList.add("item-list"),this.rowHeight=36,this.width=315,o.createShadowRootWithCoreStyles(this.glassPane.contentElement,{cssFile:_r,delegatesFocus:void 0}).appendChild(this.list.element),j(this.list.element),this.listWasShowing200msAgo=!1,this.element.addEventListener("mousedown",(e=>{this.listWasShowing200msAgo?this.hide(e):this.element.disabled||this.show(e)}),!1),this.element.addEventListener("keydown",this.onKeyDownButton.bind(this),!1),this.list.element.addEventListener("keydown",this.onKeyDownList.bind(this),!1),this.list.element.addEventListener("focusout",this.hide.bind(this),!1),this.list.element.addEventListener("mousedown",(e=>e.consume(!0)),!1),this.list.element.addEventListener("mouseup",(e=>{e.target!==this.list.element&&this.listWasShowing200msAgo&&(this.selectHighlightedItem(),this.hide(e))}),!1),e.addEventListener(sn.ItemsReplaced,this.itemsReplaced,this)}show(e){this.glassPane.isShowing()||(this.glassPane.setContentAnchorBox(this.element.boxInWindow()),this.glassPane.show(this.element.ownerDocument),this.list.element.focus(),re(this.element,!0),this.updateGlasspaneSize(),this.selectedItem&&this.list.selectItem(this.selectedItem),e.consume(!0),window.setTimeout((()=>{this.listWasShowing200msAgo=!0}),200))}updateGlasspaneSize(){const e=this.rowHeight*Math.min(this.model.length,9);this.glassPane.setMaxContentSize(new Ke(this.width,e)),this.list.viewportResized()}hide(e){window.setTimeout((()=>{this.listWasShowing200msAgo=!1}),200),this.glassPane.hide(),this.list.selectItem(null),re(this.element,!1),this.element.focus(),e.consume(!0)}onKeyDownButton(e){const t=e;let i=!1;switch(t.key){case"ArrowUp":this.show(t),this.list.selectItemNextPage(),i=!0;break;case"ArrowDown":this.show(t),this.list.selectItemPreviousPage(),i=!0;break;case"Enter":case" ":this.show(t),i=!0}i&&t.consume(!0)}onKeyDownList(e){const t=e;let i=!1;switch(t.key){case"ArrowLeft":i=this.list.selectPreviousItem(!1,!1);break;case"ArrowRight":i=this.list.selectNextItem(!1,!1);break;case"Home":for(let e=0;e<this.model.length;e++)if(this.isItemSelectable(this.model.at(e))){this.list.selectItem(this.model.at(e)),i=!0;break}break;case"End":for(let e=this.model.length-1;e>=0;e--)if(this.isItemSelectable(this.model.at(e))){this.list.selectItem(this.model.at(e)),i=!0;break}break;case"Escape":this.hide(t),i=!0;break;case"Tab":case"Enter":case" ":this.selectHighlightedItem(),this.hide(t),i=!0;break;default:if(1===t.key.length){const e=this.list.selectedIndex(),n=t.key.toUpperCase();for(let t=0;t<this.model.length;t++){const i=this.model.at((e+t+1)%this.model.length);if(this.delegate.titleFor(i).toUpperCase().startsWith(n)){this.list.selectItem(i);break}}i=!0}}i&&t.consume(!0)}setWidth(e){this.width=e,this.updateGlasspaneSize()}setRowHeight(e){this.rowHeight=e}setPlaceholderText(e){this.placeholderText=e,this.selectedItem||(this.titleElement.textContent=this.placeholderText)}itemsReplaced(e){const{removed:t}=e.data;this.selectedItem&&-1!==t.indexOf(this.selectedItem)&&(this.selectedItem=null,this.selectHighlightedItem()),this.updateGlasspaneSize()}getSelectedItem(){return this.selectedItem}selectItem(e){this.selectedItem=e,this.selectedItem?this.titleElement.textContent=this.delegate.titleFor(this.selectedItem):this.titleElement.textContent=this.placeholderText,this.delegate.itemSelected(this.selectedItem)}createElementForItem(e){const t=document.createElement("div");return t.classList.add("item"),t.addEventListener("mousemove",(t=>{(t.movementX||t.movementY)&&this.delegate.isItemSelectable(e)&&this.list.selectItem(e,!1,!0)})),t.classList.toggle("disabled",!this.delegate.isItemSelectable(e)),t.classList.toggle("highlighted",this.list.selectedItem()===e),q(t),t.appendChild(this.delegate.createElementForItem(e)),t}heightForItem(e){return this.rowHeight}isItemSelectable(e){return this.delegate.isItemSelectable(e)}selectedItemChanged(e,t,i,n){i&&i.classList.remove("highlighted"),n&&n.classList.add("highlighted"),ve(this.list.element,n),this.delegate.highlightedItemChanged(e,t,i&&i.firstElementChild,n&&n.firstElementChild)}updateSelectedItemARIA(e,t){return!1}selectHighlightedItem(){this.selectItem(this.list.selectedItem())}refreshItem(e){this.list.refreshItem(e)}}}),Gr={cssContent:".widget{padding:25px}.message{font-size:larger;white-space:pre;margin:5px}"};const Xr={devtoolsWasDisconnectedFromThe:"DevTools was disconnected from the page.",oncePageIsReloadedDevtoolsWill:"Once page is reloaded, DevTools will automatically reconnect."},Yr=t.i18n.registerUIStrings("ui/legacy/TargetCrashedScreen.ts",Xr),$r=t.i18n.getLocalizedString.bind(void 0,Yr);var Qr=Object.freeze({__proto__:null,TargetCrashedScreen:class extends _t{hideCallback;constructor(e){super(!0),this.registerRequiredCSS(Gr),this.contentElement.createChild("div","message").textContent=$r(Xr.devtoolsWasDisconnectedFromThe),this.contentElement.createChild("div","message").textContent=$r(Xr.oncePageIsReloadedDevtoolsWill),this.hideCallback=e}willHide(){this.hideCallback.call(null)}}});var Zr=Object.freeze({__proto__:null,ThrottledWidget:class extends _t{updateThrottler;updateWhenVisible;constructor(t,i){super(t),this.updateThrottler=new e.Throttler.Throttler(void 0===i?100:i),this.updateWhenVisible=!1}doUpdate(){return Promise.resolve()}update(){this.updateWhenVisible=!this.isShowing(),this.updateWhenVisible||this.updateThrottler.schedule((()=>this.isShowing()?this.doUpdate():(this.updateWhenVisible=!0,Promise.resolve())))}wasShown(){super.wasShown(),this.updateWhenVisible&&this.update()}}}),Jr={cssContent:':host{flex:1 1 auto;padding:2px 0 0}.tree-outline-disclosure:not(.tree-outline-disclosure-hide-overflow){min-width:100%;display:inline-block}.tree-outline{padding:0 0 4px 4px;margin:0;z-index:0;position:relative}.tree-outline:focus-visible{box-shadow:0 0 0 2px var(--legacy-accent-color) inset}.tree-outline li .selection{display:none;z-index:-1;margin-left:-10000px}.tree-outline:not(.hide-selection-when-blurred) li.selected{color:var(--legacy-selection-inactive-fg-color)}.tree-outline:not(.hide-selection-when-blurred) li.selected .selection{display:block;background-color:var(--legacy-selection-inactive-bg-color)}.tree-outline:not(.hide-selection-when-blurred) li.elements-drag-over .selection{display:block;margin-top:-2px;border-top:2px solid;border-top-color:var(--legacy-selection-bg-color)}.tree-outline:not(.hide-selection-when-blurred) li.hovered:not(.selected) .selection{display:block;left:3px;right:3px;background-color:var(--item-hover-color);border-radius:5px}.tree-outline:not(.hide-selection-when-blurred) li.in-clipboard .highlight{outline:1px dotted var(--color-details-hairline)}ol.tree-outline:not(.hide-selection-when-blurred) li.selected:focus .selection{background-color:var(--legacy-selection-bg-color)}ol.tree-outline:not(.hide-selection-when-blurred) li.parent.selected:focus::before{background-color:var(--legacy-selection-fg-color)}ol.tree-outline,\n.tree-outline ol{list-style-type:none}.tree-outline ol{padding-left:12px}.tree-outline li{text-overflow:ellipsis;white-space:nowrap;position:relative;display:flex;align-items:center;min-height:16px}ol.tree-outline:not(.hide-selection-when-blurred) li.selected:focus{color:var(--legacy-selection-fg-color)}ol.tree-outline:not(.hide-selection-when-blurred) li.selected:focus *{color:inherit}.tree-outline li .icons-container{align-self:center;display:flex;align-items:center}.tree-outline li .leading-icons{margin-right:4px}.tree-outline li .trailing-icons{margin-left:4px}.tree-outline li::before{user-select:none;-webkit-mask-image:var(--image-file-triangle-right);background-color:var(--icon-default);content:"\\A0\\A0";text-shadow:none;margin-right:-2px;height:14px;width:14px;transition:transform 200ms}.tree-outline li:not(.parent)::before{background-color:transparent}.tree-outline li.parent.expanded::before{transform:rotate(90deg)}.tree-outline ol.children{display:none}.tree-outline ol.children.expanded{display:block}.tree-outline.tree-outline-dense li{margin-top:1px;min-height:12px}.tree-outline.tree-outline-dense li.parent{margin-top:0}.tree-outline.tree-outline-dense li.parent::before{top:0}.tree-outline.tree-outline-dense ol{padding-left:10px}.tree-outline.hide-selection-when-blurred .selected:focus-visible{background:var(--legacy-focus-bg-color);border-radius:2px}.tree-outline-disclosure:not(.tree-outline-disclosure-hide-overflow) .tree-outline.hide-selection-when-blurred .selected:focus-visible{width:fit-content;padding-right:3px}@media (forced-colors: active){.tree-outline-disclosure li.parent::before,\n  .tree-outline:not(.hide-selection-when-blurred) li.parent:not(.selected)::before,\n  .tree-outline li [is="ui-icon"].icon-mask{forced-color-adjust:none;background-color:ButtonText}.tree-outline-disclosure li.parent:hover:not(.selected)::before,\n  .tree-outline:not(.hide-selection-when-blurred) li.parent:hover:not(.selected)::before{background-color:ButtonText}.tree-outline:not(.hide-selection-when-blurred) li.selected .selection{forced-color-adjust:none;background-color:ButtonText}ol.tree-outline:not(.hide-selection-when-blurred) li.selected:focus .selection,\n  .tree-outline.hide-selection-when-blurred .selected:focus-visible{forced-color-adjust:none;background-color:Highlight}ol.tree-outline:not(.hide-selection-when-blurred) li.parent.selected::before,\n  ol.tree-outline:not(.hide-selection-when-blurred) li.parent.selected:focus::before,\n  .tree-outline.hide-selection-when-blurred .selected:focus-visible::before{background-color:HighlightText}.tree-outline li:not(.parent)::before,\n  .tree-outline li:not(.parent):hover::before,\n  .tree-outline.hide-selection-when-blurred .selected:focus-visible:not(.parent)::before{forced-color-adjust:none;background-color:transparent}.tree-outline li.selected [is="ui-icon"].icon-mask,\n  .tree-outline li.selected:focus [is="ui-icon"]:not(.icon-mask){background-color:HighlightText!important}ol.tree-outline:not(.hide-selection-when-blurred) li.selected,\n  .tree-outline:not(.hide-selection-when-blurred) li.selected .tree-element-title,\n  .tree-outline:not(.hide-selection-when-blurred) li.selected:focus,\n  .tree-outline:not(.hide-selection-when-blurred) li:focus-visible .tree-element-title,\n  .tree-outline:not(.hide-selection-when-blurred) li.selected:focus .tree-element-title,\n  .tree-outline:not(.hide-selection-when-blurred) li.selected span,\n  .tree-outline.hide-selection-when-blurred .selected:focus-visible span{forced-color-adjust:none;color:HighlightText}.tree-outline:not(.hide-selection-when-blurred) li.selected:focus-visible devtools-adorner,\n  .tree-outline.hide-selection-when-blurred li.selected:focus-visible devtools-adorner{--override-adorner-background-color:Highlight;--override-adorner-border-color:HighlightText}.tree-outline:not(.hide-selection-when-blurred) devtools-icon,\n  .tree-outline.hide-selection-when-blurred devtools-icon{--icon-color:ButtonText}.tree-outline:not(.hide-selection-when-blurred) .selected devtools-icon,\n  .tree-outline.hide-selection-when-blurred .selected:focus-visible devtools-icon{--icon-color:HighlightText}}'};const ea=new WeakMap;var ta;!function(e){e.ElementAttached="ElementAttached",e.ElementsDetached="ElementsDetached",e.ElementExpanded="ElementExpanded",e.ElementCollapsed="ElementCollapsed",e.ElementSelected="ElementSelected"}(ta||(ta={}));class ia extends e.ObjectWrapper.ObjectWrapper{rootElementInternal;renderSelection;selectedTreeElement;expandTreeElementsWhenArrowing;comparator;contentElement;preventTabOrder;showSelectionOnKeyboardFocus;focusable;element;useLightSelectionColor;treeElementToScrollIntoView;centerUponScrollIntoView;constructor(){super(),this.rootElementInternal=this.createRootElement(),this.renderSelection=!1,this.selectedTreeElement=null,this.expandTreeElementsWhenArrowing=!1,this.comparator=null,this.contentElement=this.rootElementInternal.childrenListNode,this.contentElement.addEventListener("keydown",this.treeKeyDown.bind(this),!1),this.preventTabOrder=!1,this.showSelectionOnKeyboardFocus=!1,this.focusable=!0,this.setFocusable(!0),this.element=this.contentElement,V(this.element),this.useLightSelectionColor=!1,this.treeElementToScrollIntoView=null,this.centerUponScrollIntoView=!1}setShowSelectionOnKeyboardFocus(e,t){this.contentElement.classList.toggle("hide-selection-when-blurred",e),this.preventTabOrder=Boolean(t),this.focusable&&(this.contentElement.tabIndex=Boolean(t)?-1:0),this.showSelectionOnKeyboardFocus=e}createRootElement(){const e=new sa;return e.treeOutline=this,e.root=!0,e.selectable=!1,e.expanded=!0,e.childrenListNode.classList.remove("children"),e}rootElement(){return this.rootElementInternal}firstChild(){return this.rootElementInternal.firstChild()}lastDescendent(){let e=this.rootElementInternal.lastChild();for(;e&&e.expanded&&e.childCount();)e=e.lastChild();return e}appendChild(e,t){this.rootElementInternal.appendChild(e,t)}insertChild(e,t){this.rootElementInternal.insertChild(e,t)}removeChild(e){this.rootElementInternal.removeChild(e)}removeChildren(){this.rootElementInternal.removeChildren()}treeElementFromPoint(e,t){const i=Hs(this.contentElement.ownerDocument,e,t);if(!i)return null;const n=Fs(i,["ol","li"]);return n&&(ea.get(n)||na.get(n))||null}treeElementFromEvent(e){return e?this.treeElementFromPoint(e.pageX,e.pageY):null}setComparator(e){this.comparator=e}setFocusable(e){this.focusable=e,this.updateFocusable()}updateFocusable(){this.focusable?(this.contentElement.tabIndex=this.preventTabOrder||Boolean(this.selectedTreeElement)?-1:0,this.selectedTreeElement&&this.selectedTreeElement.setFocusable(!0)):(this.contentElement.removeAttribute("tabIndex"),this.selectedTreeElement&&this.selectedTreeElement.setFocusable(!1))}focus(){this.selectedTreeElement?this.selectedTreeElement.listItemElement.focus():this.contentElement.focus()}setUseLightSelectionColor(e){this.useLightSelectionColor=e}getUseLightSelectionColor(){return this.useLightSelectionColor}bindTreeElement(e){e.treeOutline&&console.error("Binding element for the second time: "+(new Error).stack),e.treeOutline=this,e.onbind()}unbindTreeElement(e){e.treeOutline||console.error("Unbinding element that was not bound: "+(new Error).stack),e.deselect(),e.onunbind(),e.treeOutline=null}selectPrevious(){let e=this.selectedTreeElement&&this.selectedTreeElement.traversePreviousTreeElement(!0);for(;e&&!e.selectable;)e=e.traversePreviousTreeElement(!this.expandTreeElementsWhenArrowing);return!!e&&(e.select(!1,!0),!0)}selectNext(){let e=this.selectedTreeElement&&this.selectedTreeElement.traverseNextTreeElement(!0);for(;e&&!e.selectable;)e=e.traverseNextTreeElement(!this.expandTreeElementsWhenArrowing);return!!e&&(e.select(!1,!0),!0)}forceSelect(e=!1,t=!0){this.selectedTreeElement&&this.selectedTreeElement.deselect(),this.selectFirst(e,t)}selectFirst(e=!1,t=!0){let i=this.firstChild();for(;i&&!i.selectable;)i=i.traverseNextTreeElement(!0);return!!i&&(i.select(e,t),!0)}selectLast(){let e=this.lastDescendent();for(;e&&!e.selectable;)e=e.traversePreviousTreeElement(!0);return!!e&&(e.select(!1,!0),!0)}treeKeyDown(e){if(e.shiftKey||e.metaKey||e.ctrlKey||es())return;let t=!1;this.selectedTreeElement?"ArrowUp"!==e.key||e.altKey?"ArrowDown"!==e.key||e.altKey?"ArrowLeft"===e.key?t=this.selectedTreeElement.collapseOrAscend(e.altKey):"ArrowRight"===e.key?this.selectedTreeElement.revealed()?t=this.selectedTreeElement.descendOrExpand(e.altKey):(this.selectedTreeElement.reveal(),t=!0):8===e.keyCode||46===e.keyCode?t=this.selectedTreeElement.ondelete():"Enter"===e.key?t=this.selectedTreeElement.onenter():e.keyCode===ot.Space.code?t=this.selectedTreeElement.onspace():"Home"===e.key?t=this.selectFirst():"End"===e.key&&(t=this.selectLast()):t=this.selectNext():t=this.selectPrevious():"ArrowUp"!==e.key||e.altKey?"ArrowDown"!==e.key||e.altKey||(t=this.selectFirst()):t=this.selectLast(),t&&e.consume(!0)}deferredScrollIntoView(e,t){const i=()=>{if(!this.treeElementToScrollIntoView)return;const e=this.treeElementToScrollIntoView.listItemElement.getBoundingClientRect(),t=this.contentElement.getBoundingClientRect();let i=this.element;for(;"visible"===getComputedStyle(i).overflow&&i.parentElement;)i=i.parentElement;const n=i.getBoundingClientRect(),s=n.left-t.left,o=n.top-t.top+this.contentElement.offsetTop;let r=e.left-t.left;r>s&&r<s+n.width?r=s:this.centerUponScrollIntoView&&(r-=n.width/2);let a=e.top-t.top;a>o&&a<o+n.height?a=o:this.centerUponScrollIntoView&&(a-=n.height/2),i.scrollTo(r,a),this.treeElementToScrollIntoView=null};this.treeElementToScrollIntoView||this.element.window().requestAnimationFrame(i),this.treeElementToScrollIntoView=e,this.centerUponScrollIntoView=t}onStartedEditingTitle(e){}}const na=new WeakMap;class sa{treeOutline;parent;previousSibling;nextSibling;boundOnFocus;boundOnBlur;listItemNode;titleElement;titleInternal;childrenInternal;childrenListNode;hiddenInternal;selectableInternal;expanded;selected;expandable;#o=!0;collapsible;toggleOnClick;button;root;tooltipInternal;leadingIconsElement;trailingIconsElement;selectionElementInternal;disableSelectFocus;constructor(e,t){this.treeOutline=null,this.parent=null,this.previousSibling=null,this.nextSibling=null,this.boundOnFocus=this.onFocus.bind(this),this.boundOnBlur=this.onBlur.bind(this),this.listItemNode=document.createElement("li"),this.titleElement=this.listItemNode.createChild("span","tree-element-title"),na.set(this.listItemNode,this),this.titleInternal="",e&&(this.title=e),this.listItemNode.addEventListener("mousedown",this.handleMouseDown.bind(this),!1),this.listItemNode.addEventListener("click",this.treeElementToggled.bind(this),!1),this.listItemNode.addEventListener("dblclick",this.handleDoubleClick.bind(this),!1),U(this.listItemNode),this.childrenInternal=null,this.childrenListNode=document.createElement("ol"),ea.set(this.childrenListNode,this),this.childrenListNode.classList.add("children"),F(this.childrenListNode),this.hiddenInternal=!1,this.selectableInternal=!0,this.expanded=!1,this.selected=!1,this.setExpandable(t||!1),this.collapsible=!0,this.toggleOnClick=!1,this.button=null,this.root=!1,this.tooltipInternal="",this.leadingIconsElement=null,this.trailingIconsElement=null,this.selectionElementInternal=null,this.disableSelectFocus=!1}static getTreeElementBylistItemNode(e){return na.get(e)}hasAncestor(e){if(!e)return!1;let t=this.parent;for(;t;){if(e===t)return!0;t=t.parent}return!1}hasAncestorOrSelf(e){return this===e||this.hasAncestor(e)}isHidden(){if(this.hidden)return!0;let e=this.parent;for(;e;){if(e.hidden)return!0;e=e.parent}return!1}children(){return this.childrenInternal||[]}childCount(){return this.childrenInternal?this.childrenInternal.length:0}firstChild(){return this.childrenInternal?this.childrenInternal[0]:null}lastChild(){return this.childrenInternal?this.childrenInternal[this.childrenInternal.length-1]:null}childAt(e){return this.childrenInternal?this.childrenInternal[e]:null}indexOfChild(e){return this.childrenInternal?this.childrenInternal.indexOf(e):-1}appendChild(e,t){let i;this.childrenInternal||(this.childrenInternal=[]),i=t?n.ArrayUtilities.lowerBound(this.childrenInternal,e,t):this.treeOutline&&this.treeOutline.comparator?n.ArrayUtilities.lowerBound(this.childrenInternal,e,this.treeOutline.comparator):this.childrenInternal.length,this.insertChild(e,i)}insertChild(e,t){if(this.childrenInternal||(this.childrenInternal=[]),!e)throw"child can't be undefined or null";console.assert(!e.parent,"Attempting to insert a child that is already in the tree, reparenting is not supported.");const i=t>0?this.childrenInternal[t-1]:null;i?(i.nextSibling=e,e.previousSibling=i):e.previousSibling=null;const n=this.childrenInternal[t];n?(n.previousSibling=e,e.nextSibling=n):e.nextSibling=null,this.childrenInternal.splice(t,0,e),this.setExpandable(!0),e.parent=this,this.treeOutline&&this.treeOutline.bindTreeElement(e);for(let t=e.firstChild();this.treeOutline&&t;t=t.traverseNextTreeElement(!1,e,!0))this.treeOutline.bindTreeElement(t);e.onattach(),e.ensureSelection(),this.treeOutline&&this.treeOutline.dispatchEventToListeners(ta.ElementAttached,e);const s=e.nextSibling?e.nextSibling.listItemNode:null;this.childrenListNode.insertBefore(e.listItemNode,s),this.childrenListNode.insertBefore(e.childrenListNode,s),e.selected&&e.select(),e.expanded&&e.expand()}removeChildAtIndex(e){if(!this.childrenInternal||e<0||e>=this.childrenInternal.length)throw"childIndex out of range";const t=this.childrenInternal[e];this.childrenInternal.splice(e,1);const i=t.parent;this.treeOutline&&this.treeOutline.selectedTreeElement&&this.treeOutline.selectedTreeElement.hasAncestorOrSelf(t)&&(t.nextSibling?t.nextSibling.select(!0):t.previousSibling?t.previousSibling.select(!0):i&&i.select(!0)),t.previousSibling&&(t.previousSibling.nextSibling=t.nextSibling),t.nextSibling&&(t.nextSibling.previousSibling=t.previousSibling),t.parent=null,this.treeOutline&&this.treeOutline.unbindTreeElement(t);for(let e=t.firstChild();this.treeOutline&&e;e=e.traverseNextTreeElement(!1,t,!0))this.treeOutline.unbindTreeElement(e);t.detach(),this.treeOutline&&this.treeOutline.dispatchEventToListeners(ta.ElementsDetached)}removeChild(e){if(!e)throw"child can't be undefined or null";if(e.parent!==this)return;const t=this.childrenInternal?this.childrenInternal.indexOf(e):-1;if(-1===t)throw"child not found in this node's children";this.removeChildAtIndex(t)}removeChildren(){if(!this.root&&this.treeOutline&&this.treeOutline.selectedTreeElement&&this.treeOutline.selectedTreeElement.hasAncestorOrSelf(this)&&this.select(!0),this.childrenInternal)for(const e of this.childrenInternal){e.previousSibling=null,e.nextSibling=null,e.parent=null,this.treeOutline&&this.treeOutline.unbindTreeElement(e);for(let t=e.firstChild();this.treeOutline&&t;t=t.traverseNextTreeElement(!1,e,!0))this.treeOutline.unbindTreeElement(t);e.detach()}this.childrenInternal=[],this.treeOutline&&this.treeOutline.dispatchEventToListeners(ta.ElementsDetached)}get selectable(){return!this.isHidden()&&this.selectableInternal}set selectable(e){this.selectableInternal=e}get listItemElement(){return this.listItemNode}get childrenListElement(){return this.childrenListNode}get title(){return this.titleInternal}set title(e){this.titleInternal!==e&&(this.titleInternal=e,"string"==typeof e?(this.titleElement.textContent=e,this.tooltip=e):(this.titleElement=e,this.tooltip=""),this.listItemNode.removeChildren(),this.leadingIconsElement&&this.listItemNode.appendChild(this.leadingIconsElement),this.listItemNode.appendChild(this.titleElement),this.trailingIconsElement&&this.listItemNode.appendChild(this.trailingIconsElement),this.ensureSelection())}titleAsText(){return this.titleInternal?"string"==typeof this.titleInternal?this.titleInternal:this.titleInternal.textContent||"":""}startEditingTitle(e){ar.startEditing(this.titleElement,e),this.treeOutline&&this.treeOutline.onStartedEditingTitle(this)}setLeadingIcons(e){if(this.leadingIconsElement||e.length){this.leadingIconsElement||(this.leadingIconsElement=document.createElement("div"),this.leadingIconsElement.classList.add("leading-icons"),this.leadingIconsElement.classList.add("icons-container"),this.listItemNode.insertBefore(this.leadingIconsElement,this.titleElement),this.ensureSelection()),this.leadingIconsElement.removeChildren();for(const t of e)this.leadingIconsElement.appendChild(t)}}setTrailingIcons(e){if(this.trailingIconsElement||e.length){this.trailingIconsElement||(this.trailingIconsElement=document.createElement("div"),this.trailingIconsElement.classList.add("trailing-icons"),this.trailingIconsElement.classList.add("icons-container"),this.listItemNode.appendChild(this.trailingIconsElement),this.ensureSelection()),this.trailingIconsElement.removeChildren();for(const t of e)this.trailingIconsElement.appendChild(t)}}get tooltip(){return this.tooltipInternal}set tooltip(e){this.tooltipInternal!==e&&(this.tooltipInternal=e,ii.install(this.listItemNode,e))}isExpandable(){return this.expandable}setExpandable(e){this.expandable!==e&&(this.expandable=e,this.listItemNode.classList.toggle("parent",e),e?re(this.listItemNode,!1):(this.collapse(),ae(this.listItemNode)))}isExpandRecursively(){return this.#o}setExpandRecursively(e){this.#o=e}isCollapsible(){return this.collapsible}setCollapsible(e){this.collapsible!==e&&(this.collapsible=e,this.listItemNode.classList.toggle("always-parent",!e),e||this.expand())}get hidden(){return this.hiddenInternal}set hidden(e){if(this.hiddenInternal!==e&&(this.hiddenInternal=e,this.listItemNode.classList.toggle("hidden",e),this.childrenListNode.classList.toggle("hidden",e),e&&this.treeOutline&&this.treeOutline.selectedTreeElement&&this.treeOutline.selectedTreeElement.hasAncestorOrSelf(this))){const e=this.treeOutline.selectedTreeElement.listItemElement.hasFocus();this.treeOutline.forceSelect(!e,!1)}}invalidateChildren(){this.childrenInternal&&(this.removeChildren(),this.childrenInternal=null)}ensureSelection(){this.treeOutline&&this.treeOutline.renderSelection&&(this.selectionElementInternal||(this.selectionElementInternal=document.createElement("div"),this.selectionElementInternal.classList.add("selection"),this.selectionElementInternal.classList.add("fill")),this.listItemNode.insertBefore(this.selectionElementInternal,this.listItemElement.firstChild))}treeElementToggled(e){const t=e.currentTarget;if(!t||na.get(t)!==this||t.hasSelection())return;console.assert(Boolean(this.treeOutline));const i=!!this.treeOutline&&this.treeOutline.showSelectionOnKeyboardFocus,n=this.toggleOnClick&&(i||!this.selectable),s=this.isEventWithinDisclosureTriangle(e);(n||s)&&(this.expanded?e.altKey?this.collapseRecursively():this.collapse():e.altKey?this.expandRecursively():this.expand(),e.consume())}handleMouseDown(e){const t=e.currentTarget;t&&this.selectable&&na.get(t)===this&&(this.isEventWithinDisclosureTriangle(e)||this.selectOnMouseDown(e))}handleDoubleClick(e){const t=e.currentTarget;if(!t||na.get(t)!==this)return;this.ondblclick(e)||this.expandable&&!this.expanded&&this.expand()}detach(){this.listItemNode.remove(),this.childrenListNode.remove()}collapse(){if(!this.expanded||!this.collapsible)return;this.listItemNode.classList.remove("expanded"),this.childrenListNode.classList.remove("expanded"),re(this.listItemNode,!1),this.expanded=!1,this.oncollapse(),this.treeOutline&&this.treeOutline.dispatchEventToListeners(ta.ElementCollapsed,this);const e=this.treeOutline&&this.treeOutline.selectedTreeElement;e&&e.hasAncestor(this)&&this.select(!0,!0)}collapseRecursively(){let e=this;for(;e;)e.expanded&&e.collapse(),e=e.traverseNextTreeElement(!1,this,!0)}collapseChildren(){if(this.childrenInternal)for(const e of this.childrenInternal)e.collapseRecursively()}expand(){!this.expandable||this.expanded&&this.childrenInternal||(this.expanded=!0,this.populateIfNeeded(),this.listItemNode.classList.add("expanded"),this.childrenListNode.classList.add("expanded"),re(this.listItemNode,!0),this.treeOutline&&(this.onexpand(),this.treeOutline.dispatchEventToListeners(ta.ElementExpanded,this)))}async expandRecursively(e){let t=this;const i={depthChange:0};let n=0;(void 0===e||isNaN(e))&&(e=3);do{t.isExpandRecursively()&&(await t.populateIfNeeded(),n<e&&t.expand()),t=t.traverseNextTreeElement(!t.isExpandRecursively(),this,!0,i),n+=i.depthChange}while(null!==t)}collapseOrAscend(e){if(this.expanded&&this.collapsible)return e?this.collapseRecursively():this.collapse(),!0;if(!this.parent||this.parent.root)return!1;if(!this.parent.selectable)return this.parent.collapse(),!0;let t=this.parent;for(;t&&!t.selectable;)t=t.parent;return!!t&&(t.select(!1,!0),!0)}descendOrExpand(e){if(!this.expandable)return!1;if(!this.expanded)return e?this.expandRecursively():this.expand(),!0;let t=this.firstChild();for(;t&&!t.selectable;)t=t.nextSibling;return!!t&&(t.select(!1,!0),!0)}reveal(e){let t=this.parent;for(;t&&!t.root;)t.expanded||t.expand(),t=t.parent;this.treeOutline&&this.treeOutline.deferredScrollIntoView(this,Boolean(e))}revealed(){let e=this.parent;for(;e&&!e.root;){if(!e.expanded)return!1;e=e.parent}return!0}selectOnMouseDown(e){if(this.select(!1,!0)&&e.consume(!0),this.listItemNode.draggable&&this.selectionElementInternal&&this.treeOutline){const e=this.treeOutline.element.getBoundingClientRect().left-this.listItemNode.getBoundingClientRect().left-this.treeOutline.element.scrollLeft;this.selectionElementInternal.style.setProperty("margin-left",e+"px")}}select(e,t){if(e=e||this.disableSelectFocus,!this.treeOutline||!this.selectable||this.selected)return e||this.listItemElement.focus(),!1;const i=this.treeOutline.selectedTreeElement;return this.treeOutline.selectedTreeElement=null,this.treeOutline.rootElementInternal===this?(i&&i.deselect(),e||this.listItemElement.focus(),!1):(this.selected=!0,this.treeOutline.selectedTreeElement=this,this.treeOutline.updateFocusable(),e&&!this.treeOutline.contentElement.hasFocus()||this.listItemElement.focus(),this.listItemNode.classList.add("selected"),ue(this.listItemNode,!0),this.treeOutline.dispatchEventToListeners(ta.ElementSelected,this),i&&i.deselect(),this.onselect(t))}setFocusable(e){e?(this.listItemNode.setAttribute("tabIndex",this.treeOutline&&this.treeOutline.preventTabOrder?"-1":"0"),this.listItemNode.addEventListener("focus",this.boundOnFocus,!1),this.listItemNode.addEventListener("blur",this.boundOnBlur,!1)):(this.listItemNode.removeAttribute("tabIndex"),this.listItemNode.removeEventListener("focus",this.boundOnFocus,!1),this.listItemNode.removeEventListener("blur",this.boundOnBlur,!1))}onFocus(){this.treeOutline&&!this.treeOutline.getUseLightSelectionColor()&&(this.treeOutline.contentElement.classList.contains("hide-selection-when-blurred")||this.listItemNode.classList.add("force-white-icons"))}onBlur(){this.treeOutline&&!this.treeOutline.getUseLightSelectionColor()&&(this.treeOutline.contentElement.classList.contains("hide-selection-when-blurred")||this.listItemNode.classList.remove("force-white-icons"))}revealAndSelect(e){this.reveal(!0),this.select(e)}deselect(){const e=this.listItemNode.hasFocus();this.selected=!1,this.listItemNode.classList.remove("selected"),me(this.listItemNode),this.setFocusable(!1),this.treeOutline&&this.treeOutline.selectedTreeElement===this&&(this.treeOutline.selectedTreeElement=null,this.treeOutline.updateFocusable(),e&&this.treeOutline.focus())}async populateIfNeeded(){this.treeOutline&&this.expandable&&!this.childrenInternal&&(this.childrenInternal=[],await this.onpopulate())}async onpopulate(){}onenter(){return!1}ondelete(){return!1}onspace(){return!1}onbind(){}onunbind(){}onattach(){}onexpand(){}oncollapse(){}ondblclick(e){return!1}onselect(e){return!1}traverseNextTreeElement(e,t,i,n){i||this.populateIfNeeded(),n&&(n.depthChange=0);let s=e?this.revealed()?this.firstChild():null:this.firstChild();if(s&&(!e||e&&this.expanded))return n&&(n.depthChange=1),s;if(this===t)return null;if(s=e?this.revealed()?this.nextSibling:null:this.nextSibling,s)return s;for(s=this;s&&!s.root&&!(e?s.revealed()&&s.nextSibling:s.nextSibling)&&s.parent!==t;)n&&(n.depthChange-=1),s=s.parent;return!s||s.root?null:e?s.revealed()?s.nextSibling:null:s.nextSibling}traversePreviousTreeElement(e,t){let i=e?this.revealed()?this.previousSibling:null:this.previousSibling;for(!t&&i&&i.populateIfNeeded();i&&(e?i.revealed()&&i.expanded&&i.lastChild():i.lastChild());)t||i.populateIfNeeded(),i=e?i.revealed()&&i.expanded?i.lastChild():null:i.lastChild();return i||(!this.parent||this.parent.root?null:this.parent)}isEventWithinDisclosureTriangle(e){const t=window.getComputedStyle(this.listItemNode).paddingLeft;console.assert(t.endsWith("px"));const i=parseFloat(t),n=this.listItemNode.getBoundingClientRect().left+i;return e.pageX>=n&&e.pageX<=n+10&&this.expandable}setDisableSelectFocus(e){this.disableSelectFocus=e}}var oa=Object.freeze({__proto__:null,get Events(){return ta},TreeOutline:ia,TreeOutlineInShadow:class extends ia{element;shadowRoot;disclosureElement;renderSelection;constructor(){super(),this.contentElement.classList.add("tree-outline"),this.element=document.createElement("div"),this.shadowRoot=o.createShadowRootWithCoreStyles(this.element,{cssFile:Jr,delegatesFocus:void 0}),this.disclosureElement=this.shadowRoot.createChild("div","tree-outline-disclosure"),this.disclosureElement.appendChild(this.contentElement),this.renderSelection=!0}registerRequiredCSS(e){c.ThemeSupport.instance().appendStyle(this.shadowRoot,e)}registerCSSFiles(e){this.shadowRoot.adoptedStyleSheets=this.shadowRoot.adoptedStyleSheets.concat(e)}hideOverflow(){this.disclosureElement.classList.add("tree-outline-disclosure-hide-overflow")}makeDense(){this.contentElement.classList.add("tree-outline-dense")}onStartedEditingTitle(e){const t=this.shadowRoot.getSelection();t&&t.selectAllChildren(e.titleElement)}},treeElementBylistItemNode:na,TreeElement:sa});var ra=Object.freeze({__proto__:null,SimpleView:class extends _t{#r;#a;constructor(e,t,i){super(t),this.#r=e,this.#a=i??e}viewId(){return this.#a}title(){return this.#r}isCloseable(){return!1}isTransient(){return!1}toolbarItems(){return Promise.resolve([])}widget(){return Promise.resolve(this)}revealView(){return Pi.instance().revealView(this)}disposeView(){}isPreviewFeature(){return!1}}});export{Te as ARIAUtils,T as ActionRegistration,P as ActionRegistry,f as Context,Me as ContextFlavorListener,Eo as ContextMenu,Zs as Dialog,wt as DockController,So as DropTarget,Ko as EmptyWidget,Jo as FilterBar,er as FilterSuggestionBuilder,ir as ForwardedInputEventHandler,Bo as Fragment,qe as Geometry,Ys as GlassPane,or as HistoryInput,Oe as Icon,Tt as Infobar,hr as InplaceEditor,Zi as InspectorView,lt as KeyboardShortcut,dn as ListControl,ln as ListModel,pr as ListWidget,br as Panel,wr as PopoverHelper,Er as ProgressIndicator,Tr as RemoteDebuggingTerminatedScreen,Pr as ReportView,Pt as ResizerWidget,Rr as RootView,Nr as SearchableView,on as SettingsUI,ro as ShortcutRegistry,mo as SoftContextMenu,qr as SoftDropDown,ti as SplitWidget,bn as SuggestBox,ui as TabbedPane,Qr as TargetCrashedScreen,En as TextPrompt,Zr as ThrottledWidget,Nn as Toolbar,ni as Tooltip,oa as TreeOutline,Vs as UIUtils,ra as View,zi as ViewManager,jt as Widget,At as XElement,No as XLink,Ft as XWidget,$t as ZoomManager};
